Upgrading the connection to WebSocket
-
When you want to start communicating with a website via WebSocket you will need to send a request to upgrade from the HTTP protocol to the WS protocol (or equivalently HTTPS and WSS, their secure versions).
Your request needs to be shaped like this:
REQUEST GET "https://www.example.com:8081/websocket" HEADER "Connection: Upgrade" HEADER "Cache-Control: no-cache" HEADER "Upgrade: websocket" HEADER "Sec-WebSocket-Version: 13" HEADER "Accept-Encoding: gzip, deflate, br" HEADER "Sec-WebSocket-Key: hQ84EMNKdFvt9OdiGvKffw==" HEADER "Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits"
You can get the Sec-WebSocket-Key required for secure WebSocket (WSS) by sniffing the request made by your browser during the protocol upgrade.
After that, you can talk to the server over WebSocket like this (by default it connects via WSS)
TCP Connect "example.com" "8081" TCP Send "This is now a websocket message!\\r\\n" WebSocket=TRUE TCP Disconnect
Remember to always end your messages with
\r\n
otherwise the server will listen for the end of the message for an indefinite amount of time.
-
Note: this feature is only available from this commit onwards https://github.com/openbullet/openbullet/commit/294e6f93caa6e0e13d4a4b808fd022145fd4d75e
-
my url is like https://abc.com/socket.io/?EIO=3&transport=websocket&encoding=text
should i add '':8081/websocket'' as suffix? or the url above? and in TCP connect is this correct host > abc.com/socket.io/?EIO=3&transport=websocket&encoding=text or
abc.com only. with 8081 port. thanks for this nice forum @Ruri
-
I have no clue