7
var ws = new WebSocket('ws://localhost:8080/activity/hello');

ws.onopen = () => {
    // connection opened
    ws.send('something'); // send a message
};

ws.onmessage = (e) => {
   // a message was received
    console.log(e.data);
};

ws.onerror = (e) => {

    // an error occurred
    console.log(e.message);
};

ws.onclose = (e) => {
    // connection closed
    console.log(e.code, e.reason);
};

How do I get the value that server is returning? Also what does the client expect?

thanks Amish

Amish Shah
  • 111
  • 1
  • 3

0 Answers0