Coming soon - Get a detailed view of why an account is flagged as spam!
view details

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.

4
What kind of data is this, and how can I decode it?
Post Body

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.

Author
Account Strength
100%
Account Age
14 years
Verified Email
Yes
Verified Flair
No
Total Karma
32,221
Link Karma
1,892
Comment Karma
30,251
Profile updated: 6 days ago
Posts updated: 9 months ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
13 years ago