使用react本机客户端和Jetty Spring服务器进行无效的Sec-WebSocket-Accept响应

时间:2017-01-25 19:34:42

标签: react-native spring-websocket

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);
};

如何获取服务器返回的值?客户还期望什么?

感谢 阿米什

0 个答案:

没有答案