Skip to content
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

About Using Websocket #445

Open
kuyeon opened this issue Aug 27, 2021 · 2 comments
Open

About Using Websocket #445

kuyeon opened this issue Aug 27, 2021 · 2 comments

Comments

@kuyeon
Copy link

kuyeon commented Aug 27, 2021

How to send data from server client, by websocket?

Any simple example code?

@jersobh
Copy link
Collaborator

jersobh commented Aug 31, 2021

Use the sock.send function:

var sock = new SockJS('https://mydomain.com/my_prefix');
 sock.onopen = function() {
     console.log('open');
     sock.send('test');
 };

 sock.onmessage = function(e) {
     console.log('message', e.data);
     sock.close();
 };

 sock.onclose = function() {
     console.log('close');
 };

See client documentation

@kuyeon
Copy link
Author

kuyeon commented Sep 2, 2021

Thank you for answer.
By the way, I meant the server-side example code, may I ask for one?

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