@live-change/dao-websocket 0.5.22 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +5 -4
- package/lib/WebSocketConnection.js +6 -6
- package/lib/WebSocketServerConnection.js +2 -2
- package/package.json +8 -7
- package/tests/connection.js +7 -8
- package/tests-bundle.js +76 -0
- package/browser.js +0 -3
package/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
1
|
+
import WebSocketConnection from "./lib/WebSocketConnection.js"
|
|
2
|
+
import WebSocketServerConnection from "./lib/WebSocketServerConnection.js"
|
|
3
|
+
|
|
4
|
+
export { WebSocketConnection, WebSocketServerConnection }
|
|
5
|
+
export { WebSocketConnection as client, WebSocketServerConnection as server }
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const debug =
|
|
1
|
+
import WebSocket from 'universal-websocket-client'
|
|
2
|
+
import { ReactiveConnection } from '@live-change/dao'
|
|
3
|
+
import Debug from 'debug'
|
|
4
|
+
const debug = Debug('reactive-dao-ws')
|
|
5
5
|
|
|
6
|
-
class WebSocketConnection extends
|
|
6
|
+
class WebSocketConnection extends ReactiveConnection {
|
|
7
7
|
constructor(credentials, url, settings) {
|
|
8
8
|
super(credentials, settings)
|
|
9
9
|
this.url = url
|
|
@@ -69,4 +69,4 @@ class WebSocketConnection extends Connection {
|
|
|
69
69
|
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
|
|
72
|
+
export default WebSocketConnection
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import EventEmitter from 'events'
|
|
2
2
|
|
|
3
3
|
class WebSocketServerConnection extends EventEmitter {
|
|
4
4
|
constructor(request, origin) {
|
|
@@ -26,4 +26,4 @@ class WebSocketServerConnection extends EventEmitter {
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
export default WebSocketServerConnection
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@live-change/dao-websocket",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"author": {
|
|
5
5
|
"email": "m8@em8.pl",
|
|
6
6
|
"name": "Michał Łaszczewski",
|
|
@@ -10,23 +10,23 @@
|
|
|
10
10
|
"url": "https://github.com/live-change/live-change-dao/issues"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@live-change/dao": "^0.
|
|
13
|
+
"@live-change/dao": "^0.6.0",
|
|
14
14
|
"bufferutil": "^4.0.3",
|
|
15
15
|
"debug": "^4.3.4",
|
|
16
|
-
"supports-color": "^
|
|
16
|
+
"supports-color": "^9.4.0",
|
|
17
17
|
"universal-websocket-client": "^1.0.1",
|
|
18
18
|
"utf-8-validate": "^5.0.4",
|
|
19
19
|
"websocket": "^1.0.34"
|
|
20
20
|
},
|
|
21
21
|
"description": "live-change dao websocket transport",
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"
|
|
23
|
+
"tape": "^5.7.4"
|
|
24
24
|
},
|
|
25
25
|
"directories": {},
|
|
26
26
|
"homepage": "https://github.com/live-change/live-change-dao",
|
|
27
27
|
"license": "BSD-3-Clause",
|
|
28
28
|
"main": "index.js",
|
|
29
|
-
"
|
|
29
|
+
"type": "module",
|
|
30
30
|
"maintainers": [
|
|
31
31
|
{
|
|
32
32
|
"email": "michal@laszczewski.com",
|
|
@@ -39,7 +39,8 @@
|
|
|
39
39
|
"url": ""
|
|
40
40
|
},
|
|
41
41
|
"scripts": {
|
|
42
|
-
"compileTests": "webpack
|
|
42
|
+
"compileTests": "webpack tests/*.js tests-bundle.js",
|
|
43
|
+
"test": "NODE_ENV=test tape tests/*"
|
|
43
44
|
},
|
|
44
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "a74891e96d33fc1f70f49423f3e560517890f067"
|
|
45
46
|
}
|
package/tests/connection.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const rdws = require("../index.js")
|
|
1
|
+
import test from 'tape'
|
|
2
|
+
import * as testServerDao from '@live-change/dao/tests/testServerDao.js'
|
|
3
|
+
import ReactiveDao from "@live-change/dao"
|
|
4
|
+
import { server as WebSocketConnection } from 'websocket'
|
|
5
|
+
import http from 'http'
|
|
6
|
+
import * as rdws from '../index.js'
|
|
8
7
|
|
|
9
8
|
test("time value", (t) => {
|
|
10
9
|
t.plan(4)
|
|
@@ -28,7 +27,7 @@ test("time value", (t) => {
|
|
|
28
27
|
console.log('Server is listening on port',port);
|
|
29
28
|
})
|
|
30
29
|
|
|
31
|
-
let wsServer = new
|
|
30
|
+
let wsServer = new WebSocketConnection({ httpServer, autoAcceptConnections: false })
|
|
32
31
|
wsServer.on("request",(request) => {
|
|
33
32
|
t.pass("WebSocket request made")
|
|
34
33
|
let serverConnection = new rdws.server(request)
|
package/tests-bundle.js
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/******/ (function(modules) { // webpackBootstrap
|
|
2
|
+
/******/ // The module cache
|
|
3
|
+
/******/ var installedModules = {};
|
|
4
|
+
/******/
|
|
5
|
+
/******/ // The require function
|
|
6
|
+
/******/ function __webpack_require__(moduleId) {
|
|
7
|
+
/******/
|
|
8
|
+
/******/ // Check if module is in cache
|
|
9
|
+
/******/ if(installedModules[moduleId]) {
|
|
10
|
+
/******/ return installedModules[moduleId].exports;
|
|
11
|
+
/******/ }
|
|
12
|
+
/******/ // Create a new module (and put it into the cache)
|
|
13
|
+
/******/ var module = installedModules[moduleId] = {
|
|
14
|
+
/******/ i: moduleId,
|
|
15
|
+
/******/ l: false,
|
|
16
|
+
/******/ exports: {}
|
|
17
|
+
/******/ };
|
|
18
|
+
/******/
|
|
19
|
+
/******/ // Execute the module function
|
|
20
|
+
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
21
|
+
/******/
|
|
22
|
+
/******/ // Flag the module as loaded
|
|
23
|
+
/******/ module.l = true;
|
|
24
|
+
/******/
|
|
25
|
+
/******/ // Return the exports of the module
|
|
26
|
+
/******/ return module.exports;
|
|
27
|
+
/******/ }
|
|
28
|
+
/******/
|
|
29
|
+
/******/
|
|
30
|
+
/******/ // expose the modules object (__webpack_modules__)
|
|
31
|
+
/******/ __webpack_require__.m = modules;
|
|
32
|
+
/******/
|
|
33
|
+
/******/ // expose the module cache
|
|
34
|
+
/******/ __webpack_require__.c = installedModules;
|
|
35
|
+
/******/
|
|
36
|
+
/******/ // identity function for calling harmony imports with the correct context
|
|
37
|
+
/******/ __webpack_require__.i = function(value) { return value; };
|
|
38
|
+
/******/
|
|
39
|
+
/******/ // define getter function for harmony exports
|
|
40
|
+
/******/ __webpack_require__.d = function(exports, name, getter) {
|
|
41
|
+
/******/ if(!__webpack_require__.o(exports, name)) {
|
|
42
|
+
/******/ Object.defineProperty(exports, name, {
|
|
43
|
+
/******/ configurable: false,
|
|
44
|
+
/******/ enumerable: true,
|
|
45
|
+
/******/ get: getter
|
|
46
|
+
/******/ });
|
|
47
|
+
/******/ }
|
|
48
|
+
/******/ };
|
|
49
|
+
/******/
|
|
50
|
+
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
51
|
+
/******/ __webpack_require__.n = function(module) {
|
|
52
|
+
/******/ var getter = module && module.__esModule ?
|
|
53
|
+
/******/ function getDefault() { return module['default']; } :
|
|
54
|
+
/******/ function getModuleExports() { return module; };
|
|
55
|
+
/******/ __webpack_require__.d(getter, 'a', getter);
|
|
56
|
+
/******/ return getter;
|
|
57
|
+
/******/ };
|
|
58
|
+
/******/
|
|
59
|
+
/******/ // Object.prototype.hasOwnProperty.call
|
|
60
|
+
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
|
61
|
+
/******/
|
|
62
|
+
/******/ // __webpack_public_path__
|
|
63
|
+
/******/ __webpack_require__.p = "";
|
|
64
|
+
/******/
|
|
65
|
+
/******/ // Load entry module and return exports
|
|
66
|
+
/******/ return __webpack_require__(__webpack_require__.s = 0);
|
|
67
|
+
/******/ })
|
|
68
|
+
/************************************************************************/
|
|
69
|
+
/******/ ([
|
|
70
|
+
/* 0 */
|
|
71
|
+
/***/ (function(module, exports) {
|
|
72
|
+
|
|
73
|
+
throw new Error("Module parse failed: /home/m8/IdeaProjects/live-change/live-change-dao/dao-websocket/tests/connection.js Unexpected token (7:6)\nYou may need an appropriate loader to handle this file type.\n| import * as rdws from '../index.js'\n| \n| const (\"../index.js\")\n| \n| test(\"time value\", (t) => {");
|
|
74
|
+
|
|
75
|
+
/***/ })
|
|
76
|
+
/******/ ]);
|
package/browser.js
DELETED