We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
There is a type mismatch between the server's expected data type and the client's sent data type when handling the end-of-audio signal.
The server's get_audio_from_websocket() method expects binary data and checks for b"END_OF_AUDIO":
def get_audio_from_websocket(self, websocket): frame_data = websocket.recv() if frame_data == b"END_OF_AUDIO": # Expects bytes return False return np.frombuffer(frame_data, dtype=np.float32)
However, the ServeClientBase.disconnect() method sends a string message:
def disconnect(self): self.websocket.send(json.dumps({ # Sends string "uid": self.client_uid, "message": self.DISCONNECT }))
This causes a "bytes-like object is required, not 'str'" error when the server tries to process the disconnect message.
The server should either:
Either:
Modify disconnect() to send binary data:
def disconnect(self): self.websocket.send(b"END_OF_AUDIO")
Or modify get_audio_from_websocket() to handle both binary and string data:
def get_audio_from_websocket(self, websocket): frame_data = websocket.recv() if isinstance(frame_data, str): try: control_msg = json.loads(frame_data) if control_msg.get("message") == self.DISCONNECT: return False except json.JSONDecodeError: pass elif frame_data == b"END_OF_AUDIO": return False return np.frombuffer(frame_data, dtype=np.float32)
The text was updated successfully, but these errors were encountered:
@dnhrdt Thanks for raising the issue. Feel free to open a PR with the fix.
Sorry, something went wrong.
No branches or pull requests
There is a type mismatch between the server's expected data type and the client's sent data type when handling the end-of-audio signal.
Issue
The server's get_audio_from_websocket() method expects binary data and checks for b"END_OF_AUDIO":
However, the ServeClientBase.disconnect() method sends a string message:
This causes a "bytes-like object is required, not 'str'" error when the server tries to process the disconnect message.
Steps to Reproduce
Expected Behavior
The server should either:
Suggested Fix
Either:
Modify disconnect() to send binary data:
Or modify get_audio_from_websocket() to handle both binary and string data:
The text was updated successfully, but these errors were encountered: