8000 How to send JSON · Issue #120 · ghedipunk/PHP-Websockets · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

How to send JSON #120

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
GaLaTaS opened this issue Jun 7, 2019 · 2 comments
Open

How to send JSON #120

GaLaTaS opened this issue Jun 7, 2019 · 2 comments

Comments

@GaLaTaS
Copy link
GaLaTaS commented Jun 7, 2019

Hi, i'm trying to return a message to the client but in JSON type. I have try to json_encode the message but again the client received the MessageEvent.data as a text.

Thank you in advance

@DrkAlien
Copy link
DrkAlien commented Jun 7, 2019

Hi, can you please update us with some code lines and where did u wrote them ( what methods..etc ). Thanks.

@GaLaTaS
Copy link
Author
GaLaTaS commented Jun 7, 2019

Hi, i have create an array in frame function and json_encode it before the return.

$responseArray = array(...);
$response = json_encode($responseArray);
return chr($b1) . chr($b2) . $lengthField . $response;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
0