@@ -31,7 +31,7 @@ compiler is installed on the host system.
31
31
32
32
- ` npm install --save bufferutil ` : Improves internal buffer operations which
33
33
allows for faster processing of masked WebSocket frames and general buffer
34
- operations.
34
+ operations.
35
35
- ` npm install --save utf-8-validate ` : The specification requires validation of
36
36
invalid UTF-8 chars, some of these validations could not be done in JavaScript
37
37
hence the need for a binary addon. In most cases you will already be
@@ -110,7 +110,7 @@ wss.on('connection', function connection(ws) {
110
110
var location = url .parse (ws .upgradeReq .url , true );
111
111
// you might use location.query.access_token to authenticate or share sessions
112
112
// or ws.upgradeReq.headers.cookie (see http://stackoverflow.com/a/16395220/151312)
113
-
113
+
114
114
ws .on (' message' , function incoming (message ) {
115
115
console .log (' received: %s' , message);
116
116
});
@@ -161,7 +161,7 @@ catch (e) { /* handle error */ }
161
161
``` js
162
162
var WebSocket = require (' ws' );
163
163
var ws = new WebSocket (' ws://echo.websocket.org/' , {
164
- protocolVersion: 8 ,
164
+ protocolVersion: 8 ,
165
165
origin: ' http://websocket.org'
166
166
});
167
167
@@ -183,13 +183,6 @@ ws.on('message', function message(data, flags) {
183
183
});
184
184
```
185
185
186
- ### Browserify users
187
- When including ws via a browserify bundle, ws returns global.WebSocket which has slightly different API.
188
- You should use the standard WebSockets API instead.
189
-
190
- https://developer.mozilla.org/en-US/docs/WebSockets/Writing_WebSocket_client_applications#Availability_of_WebSockets
191
-
192
-
193
186
### Other examples
194
187
195
188
For a full example with a browser client communicating with a ws server, see the
0 commit comments