D
D
Denis Sokolov2021-06-26 22:38:10
JavaScript
Denis Sokolov, 2021-06-26 22:38:10

How to pass id via websocket?

How to pass user id with whom you communicate from client to server using websocket

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
rPman, 2021-06-27
@rPman

Serialize the message data into a string something like json, simple, universal, convenient, using JSON.stringify and decode JSON.parse.
If the message is complex and contains a lot of data of different types, so that json grows several times, then you can use binary serializers, popular and beautifully implemented - google protobuf ( it was discussed here ) or just compress the channel

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question