Update README.md

example code in readme failed in browser client by message: "Uncaught DOMException: Failed to execute 'send' on 'WebSocket': Still in CONNECTING state" so wait for connection state is opened
This commit is contained in:
Gyula Madarasz 2017-03-28 14:12:54 +01:00 committed by GitHub
parent 3a952c9156
commit bc631bd9c0

View File

@ -86,5 +86,5 @@ class MyChat implements MessageComponentInterface {
// Then some JavaScript in the browser:
var conn = new WebSocket('ws://localhost:8080/echo');
conn.onmessage = function(e) { console.log(e.data); };
conn.send('Hello Me!');
conn.onopen = function(e) { conn.send('Hello Me!'); };
```