GodotSocketIO icon indicating copy to clipboard operation
GodotSocketIO copied to clipboard

feat: add authentication token support

Open devsoleo opened this issue 1 year ago • 4 comments

I've added the possibility of using an authentication token when opening a connection. Here's how to use this feature:

client = SocketIOClient.new(backendURL, { "token": "YOUR_TOKEN_HERE" })

devsoleo avatar Mar 27 '24 18:03 devsoleo

Hey thanks for the PR. I took a look at this discussion here https://github.com/socketio/socket.io/discussions/4072 for the implementation of auth token. So it looks like you only send it with CONNECT packet. I think there's a better way to implement this. I'll create another branch and let you try it.

teamclouday avatar Mar 28 '24 14:03 teamclouday

See if this feat-auth works

teamclouday avatar Mar 28 '24 14:03 teamclouday

Thank you for your reply, I've just tried your version on my project, it works pretty well, in fact I think it's a better integration, I haven't done any more in-depth testing so I can't assure you of 100% stability.

Suggestion : wouldn't passing the namespace as the second argument to the socketio_connect function be better for code readability, so that you don't have to write "/" every time you want to use the function with a default namespace ? Having said that, the socketio_connect function is not used very often, so this enhancement may not be necessary. I'll let you decide.

devsoleo avatar Mar 28 '24 18:03 devsoleo

Thanks for the update! Yes I agree with you. I've changed it to the init function like how you did in the pr. Will merge to main branch.

teamclouday avatar Mar 28 '24 19:03 teamclouday