Skip to content
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

Can't connect to server using protobuf #1117

Closed
geohuz opened this issue May 20, 2022 · 1 comment
Closed

Can't connect to server using protobuf #1117

geohuz opened this issue May 20, 2022 · 1 comment

Comments

@geohuz
Copy link

geohuz commented May 20, 2022

Server response always cause parse error then client get {topic: 1, action: 6} which is a parse error

I'm using the dummy-client-js from the repo: https://github.com/deepstreamIO/deepstream.io-dummy-client/blob/master/src/index.ts in my reactjs App and trying to connect server as a vanilla websocket client, but I can't establish connection with the server, the response message is always {topic: 1, action: 6}, which should be an error in message parse routine, as below:

TypeError: Cannot read properties of undefined (reading 'decode')

To Reproduce
using the code above in Reactjs and connect to deepstream server.

Expected behavior
Should connect

Server version
6.0.1

Protocol (binary or text)
binary

Websocket server (node-http or uws)
uws

Server OS
ubuntu

Node version

Server config
Please share the config sections that might be relevant for this issue

Client (Js, Java, other) and client version
Js 6.0.1

Client config
Please share the config sections that might be relevant for this issue

Additional context
Add any other context about the problem here.

@geohuz
Copy link
Author

geohuz commented May 20, 2022

I fixed my problem by setting the socket binary type:

socket.binaryType="arraybuffer"

and

  const message = parse(new Uint8Array(raw.data))[0]

@geohuz geohuz closed this as completed May 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant