Add node modules and compiled JavaScript from main (#54)
Co-authored-by: Oliver King <oking3@uncc.edu>
This commit is contained in:
committed by
GitHub
parent
4a983766a0
commit
52d71d28bd
21
node_modules/isomorphic-ws/LICENSE
generated
vendored
Normal file
21
node_modules/isomorphic-ws/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2018 Zejin Zhuang <heineiuo@gmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
58
node_modules/isomorphic-ws/README.md
generated
vendored
Normal file
58
node_modules/isomorphic-ws/README.md
generated
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
# isomorphic-ws
|
||||
|
||||
Isomorphic implementation of WebSocket.
|
||||
|
||||
It uses:
|
||||
- [ws](https://github.com/websockets/ws) on Node
|
||||
- [global.WebSocket](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket) in browsers
|
||||
|
||||
## Limitations
|
||||
|
||||
Before using this module you should know that
|
||||
[`ws`](https://github.com/websockets/ws/blob/master/doc/ws.md#class-websocket)
|
||||
is not perfectly API compatible with
|
||||
[WebSocket](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket),
|
||||
you should always test your code against both Node and browsers.
|
||||
|
||||
Some major differences:
|
||||
|
||||
- no `Server` implementation in browsers
|
||||
|
||||
## Usage
|
||||
|
||||
You need to install both this package and [ws](https://github.com/websockets/ws):
|
||||
|
||||
```
|
||||
> npm i isomorphic-ws ws
|
||||
```
|
||||
|
||||
Then just require this package:
|
||||
|
||||
```js
|
||||
const WebSocket = require('isomorphic-ws')
|
||||
|
||||
const ws = new WebSocket('wss://echo.websocket.org/', {
|
||||
origin: 'https://websocket.org'
|
||||
});
|
||||
|
||||
ws.onopen = function open() {
|
||||
console.log('connected');
|
||||
ws.send(Date.now());
|
||||
});
|
||||
|
||||
ws.onclose = function close() {
|
||||
console.log('disconnected');
|
||||
});
|
||||
|
||||
ws.onmessage = function incoming(data) {
|
||||
console.log(`Roundtrip time: ${Date.now() - data} ms`);
|
||||
|
||||
setTimeout(function timeout() {
|
||||
ws.send(Date.now());
|
||||
}, 500);
|
||||
});
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
17
node_modules/isomorphic-ws/browser.js
generated
vendored
Normal file
17
node_modules/isomorphic-ws/browser.js
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
// https://github.com/maxogden/websocket-stream/blob/48dc3ddf943e5ada668c31ccd94e9186f02fafbd/ws-fallback.js
|
||||
|
||||
var ws = null
|
||||
|
||||
if (typeof WebSocket !== 'undefined') {
|
||||
ws = WebSocket
|
||||
} else if (typeof MozWebSocket !== 'undefined') {
|
||||
ws = MozWebSocket
|
||||
} else if (typeof global !== 'undefined') {
|
||||
ws = global.WebSocket || global.MozWebSocket
|
||||
} else if (typeof window !== 'undefined') {
|
||||
ws = window.WebSocket || window.MozWebSocket
|
||||
} else if (typeof self !== 'undefined') {
|
||||
ws = self.WebSocket || self.MozWebSocket
|
||||
}
|
||||
|
||||
module.exports = ws
|
8
node_modules/isomorphic-ws/index.d.ts
generated
vendored
Normal file
8
node_modules/isomorphic-ws/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
// Type definitions for isomorphic-ws
|
||||
// Run `npm install @types/ws` before using this.
|
||||
// Fix for https://github.com/heineiuo/isomorphic-ws/issues/8
|
||||
// If there is still something wrong, welcome issue.
|
||||
|
||||
import WebSocket = require('ws')
|
||||
|
||||
export = WebSocket
|
3
node_modules/isomorphic-ws/node.js
generated
vendored
Normal file
3
node_modules/isomorphic-ws/node.js
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = require('ws');
|
34
node_modules/isomorphic-ws/package.json
generated
vendored
Normal file
34
node_modules/isomorphic-ws/package.json
generated
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
{
|
||||
"name": "isomorphic-ws",
|
||||
"version": "4.0.1",
|
||||
"description": "Isomorphic implementation of WebSocket",
|
||||
"main": "node.js",
|
||||
"browser": "browser.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/heineiuo/isomorphic-ws.git"
|
||||
},
|
||||
"keywords": [
|
||||
"browser",
|
||||
"browsers",
|
||||
"isomorphic",
|
||||
"node",
|
||||
"websocket",
|
||||
"ws"
|
||||
],
|
||||
"author": "@heineiuo",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/heineiuo/isomorphic-ws/issues"
|
||||
},
|
||||
"homepage": "https://github.com/heineiuo/isomorphic-ws#readme",
|
||||
"peerDependencies": {
|
||||
"ws": "*"
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"node.js",
|
||||
"browser.js",
|
||||
"README.md"
|
||||
]
|
||||
}
|
Reference in New Issue
Block a user