1 Client Get html+js
2 socketio connect url
window.socket = io.connect('http://IP:5000?psid=12f3aa43fdc7446881a0386c850ad8b8');
3 psid = hash unique pass in databasess and it session id
def _handle_connect(self, environ, start_response, transport, b64=False):
"""Handle a client connection request."""
query = urllib.parse.parse_qs(environ.get('QUERY_STRING', ''))
if 'psid' in query:
sid = query['psid'][0]
else:
sid = uuid.uuid4().hex
#sid = self._generate_id()
how can send password to socketio in step 1 get html , maybe flask session cookie (socketio session cookie?)?
or
whan socketio connected send in io , password? give example
maybe example send hash password
You can use request.args['psid'] to get your password hash in the connect handler:
@socketio.on('connect')
def on_connect():
psid = request.args['psid']
# do what you need to do to authorize user
# return False if password is not valid
thx, i now, I understand that I was not able to form question;
probably one of the bad login attempts;
Now I look and see what to do on the server side after already spent connect event, maybe
facundoolano/socketio-auth
better-authentication-for-socket-io-no-query-strings
Sure, those are valid options. You can also do the authentication over HTTP and save the result on the session variable, which you can access from any Socket.IO handlers.
Most helpful comment
You can use
request.args['psid']to get your password hash in the connect handler: