Skip to content

ERROR:websockets.server:Error in connection handler #54

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
andvab opened this issue Dec 2, 2024 · 3 comments
Open

ERROR:websockets.server:Error in connection handler #54

andvab opened this issue Dec 2, 2024 · 3 comments

Comments

@andvab
Copy link

andvab commented Dec 2, 2024

Hi there
Aftere run the vosk server in a docker container by docker compose

Docker version 27.3.0, build e85edf8

  vosk:
    image: alphacep/kaldi-en:latest
    ports:
      - "2700:2700"

I try to connect the ws server by wscat

# wscat -c ws://0.0.0.0:2700
Connected (press CTRL+C to quit)
> qwerty
Disconnected (code: 1011, reason: "")

And after that I send an echo message the connection was closed by the error below

ERROR:websockets.server:Error in connection handler
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/websockets/server.py", line 191, in handler
await self.ws_handler(self, path)
File "/opt/vosk-server/websocket/./asr_server.py", line 69, in recognize
response, stop = await loop.run_in_executor(pool, process_chunk, rec, message)
File "/usr/lib/python3.9/concurrent/futures/thread.py", line 52, in run
result = self.fn(*self.args, **self.kwargs)
File "/opt/vosk-server/websocket/./asr_server.py", line 16, in process_chunk
elif rec.AcceptWaveform(message):
File "/usr/local/lib/python3.9/dist-packages/vosk-0.3.45-py3.9.egg/vosk/init.py", line 182, in AcceptWaveform
res = _c.vosk_recognizer_accept_waveform(self._handle, data, len(data))
TypeError: initializer for ctype 'char *' must be a bytes or list or tuple, not str

@nshmyrev
Copy link
Contributor

nshmyrev commented Dec 2, 2024

It is not expected to work with wscat this way, try our clients instead

@andvab
Copy link
Author

andvab commented Dec 2, 2024

I tried to use it with an asterisk instance. The SpeechStart application completes with "Non-zero..." error and hang ups a call. And a log of a vosk server the same.
ERROR:websockets.server:Error in connection handler Traceback (most recent call last): File "/usr/lib/python3/dist-packages/websockets/server.py", line 191, in handler await self.ws_handler(self, path) File "/opt/vosk-server/websocket/./asr_server.py", line 69, in recognize response, stop = await loop.run_in_executor(pool, process_chunk, rec, message) File "/usr/lib/python3.9/concurrent/futures/thread.py", line 52, in run result = self.fn(*self.args, **self.kwargs) File "/opt/vosk-server/websocket/./asr_server.py", line 16, in process_chunk elif rec.AcceptWaveform(message): File "/usr/local/lib/python3.9/dist-packages/vosk-0.3.45-py3.9.egg/vosk/init.py", line 182, in AcceptWaveform res = _c.vosk_recognizer_accept_waveform(self._handle, data, len(data)) TypeError: initializer for ctype 'char *' must be a bytes or list or tuple, not str

When I wrote about a behavior the vosk server with the vscat command I want to say that the asterisk doesn't a cause this issue

@nshmyrev
Copy link
Contributor

nshmyrev commented Dec 4, 2024

Try with python client first. Then try with asterisk. Do not try wscat.

The error means you send some unknown command to the server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants