Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
"Raw" (OBS) Websocket ws:// communication (_OpenClient, Get, Put), is it possible?
#7
Using info from this page: https://wiki.wireshark.org/WebSocket

Now reports HTTP/1.1 101 Switching Protocols


Code: (Select All)
Common Shared WS_Port_Client As String, WS_Server_Port As String, WS_EOL As String, WS_Server_IP As String, WS_Password As String, WS_Header As String, WS_Data As String
Common Shared c34 As String

WS_EOL = Chr$(13) + Chr$(10)
c34 = Chr$(34)

WS_Server_Port = "4455"
WS_Server_IP = "127.0.0.1"
WS_Password = "TBD"

WS_Port_Client = "TCP/IP:" + WS_Server_Port + ":"

WS_Data = "{" + c34 + "sceneName" + c34 + ":" + c34 + "BRB" + c34 + "}"


ws_client = _OpenClient(WS_Port_Client + WS_Server_IP)

WS_Header = ""

WS_Header = WS_Header + "GET / HTTP/1.1" + WS_EOL
WS_Header = WS_Header + "Host: 127.0.0.1:4455" + WS_EOL
WS_Header = WS_Header + "Connection: Upgrade" + WS_EOL
WS_Header = WS_Header + "Pragma: no-cache" + WS_EOL
WS_Header = WS_Header + "Cache-Control: no-cache" + WS_EOL
WS_Header = WS_Header + "Upgrade: websocket" + WS_EOL
WS_Header = WS_Header + "Origin: file://" + WS_EOL
WS_Header = WS_Header + "Sec-WebSocket-Version: 13" + WS_EOL
'WS_Header = WS_Header + "Sec-WebSocket-Protocol: obswebsocket.msgpack" + WS_EOL
WS_Header = WS_Header + "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36" + WS_EOL
WS_Header = WS_Header + "Accept-Encoding: gzip, deflate, sdch" + WS_EOL
WS_Header = WS_Header + "Accept-Language: zh-CN,zh;q=0.8,en-US;q=0.6,en;q=0.4" + WS_EOL
WS_Header = WS_Header + "Sec-WebSocket-Key: bKdPyn3u98cTfZJSh4TNeQ==" + WS_EOL
WS_Header = WS_Header + "Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits" + WS_EOL + WS_EOL

Put #ws_client, , WS_Header


b$ = ""
While b$ = ""
    Get #ws_client, , b$
Wend
Print b$
Reply


Messages In This Thread
RE: "Raw" (OBS) Websocket ws:// communication (_OpenClient, Get, Put), is it possible? - by loopy750 - 09-11-2023, 06:40 PM



Users browsing this thread: 2 Guest(s)