Given a URL like: 'http://my-site.com/my_ws' , I want to send 2 types of message:
public message, like the broadcasting, all people who connected to websocket will receive. e.g. current market price.
private message, only 1 person will receive, e.g. current user's balance.
I know many of the exchanges implemented this, could someone give me a clue ?
---------------------- Origin Question as below:
Today I found a very interesting website, it sends personal information via a websocket API which seems like a public channel.
My question is: how to do this? can websocket server send private information via some secret approach?
below is the websocket channel details:
General :
Request URL: wss://wbs.mxc.com/socket.io/?EIO=3&transport=websocket
Request Method: GET
Status Code: 101 Switching Protocols
Response headers:
HTTP/1.1 101 Switching Protocols
Date: Tue, 03 Sep 2019 06:13:55 GMT
Connection: upgrade
Server: nginx
upgrade: websocket
sec-websocket-accept: xr3/mMY887Utp3cnZdf37ycDWAc=
sec-websocket-extensions: permessage-deflate
request headers:
GET wss://wbs.mxc.com/socket.io/?EIO=3&transport=websocket HTTP/1.1
Host: wbs.mxc.com
Connection: Upgrade
Pragma: no-cache
Cache-Control: no-cache
Upgrade: websocket
Origin: https://www.mxc.com
Sec-WebSocket-Version: 13
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36
Accept-Encoding: gzip, deflate, br
Accept-Language: zh-CN,zh;q=0.9,en;q=0.8,zh-TW;q=0.7
Sec-WebSocket-Key: oYmhqikSoGD8AgdqrMj0XQ==
Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits
This is a website about crypto exchange.
client users can receive the public information( crypto prices ...etc) , and logged in user can receive his account balance, via the same URL.
so how to do this?
I also saw this kind of stuff in some other website such like huobi.pro, (EIO=3...
) is this a kind of websocket client framework?
thanks a lot