k2-fsa / sherpa-onnx

Speech-to-text, text-to-speech, speaker diarization, and VAD using next-gen Kaldi with onnxruntime without Internet connection. Support embedded systems, Android, iOS, Raspberry Pi, RISC-V, x86_64 servers, websocket server/client, C/C++, Python, Kotlin, C#, Go, NodeJS, Java, Swift, Dart, JavaScript, Flutter, Object Pascal, Lazarus, Rust
https://k2-fsa.github.io/sherpa/onnx/index.html
Apache License 2.0
3.7k stars 430 forks source link

if "sec-websocket-key" not in request_headers: #1574

Open Fransie-dev opened 16 hours ago

Fransie-dev commented 16 hours ago

Hi, just wanted to point out that I had to change streaming_server.py:587

        if "sec-websocket-key" not in request_headers:

to

        if "sec-websocket-key" not in request_headers.headers.keys():

to get it to work / accept incoming requests. Original error message:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/dist-packages/websockets/asyncio/server.py", line 353, in conn_handler
    await connection.handshake(
  File "/usr/local/lib/python3.11/dist-packages/websockets/asyncio/server.py", line 204, in handshake
    raise self.protocol.handshake_exc
  File "/usr/local/lib/python3.11/dist-packages/websockets/asyncio/server.py", line 146, in handshake
    response = await response
               ^^^^^^^^^^^^^^
  File "/workspace/sherpa-onnx/./python-api-examples/streaming_server.py", line 588, in process_request
    if "sec-websocket-key" not in request_headers:
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: argument of type 'Request' is not iterable
csukuangfj commented 15 hours ago

Could you make a pull request?

Fransie-dev commented 14 hours ago

I don't think I have the right permissions:

remote: Permission to k2-fsa/sherpa-onnx.git denied

csukuangfj commented 14 hours ago

Anyone can make.a.pull request.

Not everyone can push directly to.the. current repo.