View Single Post
Blowst
Senior Member
Join Date: Feb 2011
Location: Korea, Republic of
Old 06-24-2017 , 15:25   Re: Communicating with socket.io using sourcemod and socket
Reply With Quote #7

Quote:
Originally Posted by Fyren View Post
Sorry, my reply earlier was way too hasty.

Can you post the handshake headers for the request and response using both your browser and your plugin? I see you have some in your comments, but I'm not sure if that's what you hope to get or what you're actually getting.
Now, Server closes the connection after sending any data even after the handshake.
I just want to keep these connected.

OK, first(after socket connection) I send a request for getting session id:
Code:
GET /socket.io/?clienttype=SRCDS&EIO=3&transport=polling&t=LpRVJRD HTTP/1.1
Host: localhost:3000
Then, server response:
Code:
HTTP/1.1 200 OK
Content-Type: application/octet-stream
Content-Length: 101
Access-Control-Allow-Origin: *
Set-Cookie: io=q6GVx_8byvJDsuGUAAAA; Path=/; HttpOnly
Date: Sat, 24 Jun 2017 19:03:55 GMT
Connection: keep-alive
I got the session id 'q6GVx_8byvJDsuGUAAAA' now request handshaking:
Code:
GET /socket.io/?clienttype=SRCDS&EIO=3&transport=websocket&sid=q6GVx_8byvJDsuGUAAAA HTTP/1.1
Host: localhost:3000
Connection: Upgrade
Upgrade: WebSocket
Origin: http://127.0.0.1:3000/
Sec-WebSocket-Version: 13
Sec-WebSocket-Key: YW4gc3JjZHMgd3MgdGVzdA==
Then, server switch polling to websocket

Code:
HTTP/1.1 101 Switching Protocols
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Accept: g0G7yI0fUu+ZAN+kTvfCOjCqOJg=
__________________
Sorry about my poor English

Blowst is offline