简体   繁体   中英

How can I get data from a websocket url?

When I connect to a website who uses websockets, I can get the frames with the Google Developer Tools.

Data from the websocket url

So I would like to get the same data but in a program ( JS, C# ) but I actually have no idea how I should do.

I thought about make a http.request with NodeJS but it's not a http url :/ I thought about make a sample JS client but I couldn't get the data because I wasn't able to send the headers with the 'key'.

The headers

So, I really hope you have a way to help me and sorry for my basic English :(

WebSockets is a standard technology to implement stateful, persistent connections between clients and servers. It has its own protocol ws:// and wss:// (like https:// ).

What you need is a proper WebSocket client to receive data from the server.

The problem here is WebSockets it's not a protocol per se. There's no concept of request and response. It's like working with TCP sockets.

If you want to work with WebSockets, NodeJS has Socket.IO client API .

In C#, you should take a look at SignalR .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM