Kaljurand / K6nele

An Android app that offers speech-to-text user interfaces to other apps
http://kaljurand.github.io/K6nele/
Apache License 2.0
271 stars 82 forks source link

websocket issue #58

Closed YunzhaoLu closed 6 years ago

YunzhaoLu commented 6 years ago

I want to start a ratchet websocket service to collect audio data from K6nele. The websocket service is started, and I can open the websocket connection in javascript like: var ws = createWebSocket("ws://10.6.71.10:8001");

However, when I use K6nele with websocket url "ws://10.6.71.10:8001" to open websocket connection, the handshake message showed:

HTTP/1.1 101 Switching Protocols Upgrade: websocket Connection: Upgrade Sec-WebSocket-Accept: GJVr5M5/N98Sk4n1Yl2FnZI2/Os= X-Powered-By: Ratchet/0.4.1

Is there any difference to open a websocket in k6nele comparing to javascript?

regards, Yunzhao

YunzhaoLu commented 6 years ago

Sorry the above message is from opening a javascript websocket connection. When I open K6nele websocket connection, I got following message:

HTTP/1.1 426 No Sec-WebSocket-Protocols requested supported Connection: Upgrade Upgrade: websocket Sec-WebSocket-Version: 13 X-Powered-By: Ratchet/0.4.1

Regards, Yunzhao

YunzhaoLu commented 6 years ago

The difference is: in js, new WebSocket("ws://xx.xx.xx.xx:8888") not set "Sec-WebSocket-Protocol". In K6nele, client.websocket("ws://xx.xx.xx.xx:8888", ""), set "Sec-WebSocket-Protocol" = array("")

Close it.

Kaljurand commented 6 years ago

Are you proposing to change something on the Kõnele side?

YunzhaoLu commented 6 years ago

No. I changed on the server side to unset "Sec-WebSocket-Protocol" in the header when it is array of empty string(as empty array). I don't know why kaldi-gstreamer has no such problem.