This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
Hi, r/PHP!
Hopefully you can help me. I just wrote a PHP WebSockets backend, and clients using WebSockets protocol version 8 are sending data that looks like this:
<81><F7>z<A2>!g A<80> W<CF>@
This is copy/pasted from the terminal, which highlights some characters.
Obviously this is no bueno for my little project, and I assume that this is encoded in some way (binary, hex, packed, I'm not sure). Any ideas on how this can be decoded? It's supposed to be a JSON string ;)
Thanks!
Edit: I may have posed the question in a manner offensive to some. I've learned that there is possibly one WS protocol that transmits in binary rather than UTF8. However the data is still unintelligible. So in order to make this more relevant to r/PHP, I'll rephrase the question: has anybody implemented a WS server in PHP? If so, how do you handle the packet framing and decoding of the transmissions once the connection has been established?
Solved: The WS10 protocol uses an entirely different framing protocol for sending data. The data is binary, but can't be converted directly to UTF, rather it first needs to be extracted from the frame.
Post Details
- Posted
- 13 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/PHP/comment...