Skip to content

Commit f549d95

Browse files
committed
Small general changes
1 parent 2685ab2 commit f549d95

File tree

9 files changed

+21
-23
lines changed

9 files changed

+21
-23
lines changed

dist/browser.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ var dop = {
2121
// src
2222
util: {},
2323
core: {},
24-
protocol: {},
25-
transport: {listen:{}, connect:{}}
24+
protocol: {}
2625
};
2726

2827

@@ -144,16 +143,16 @@ emitter.emit(name, 4);
144143

145144
////////// src/env/browser/websocket.js
146145

147-
var connectWebsocket = function(dop, node, options) {
146+
var connectWebsocket = function websocket(dop, node, options) {
148147

149-
var url = 'ws://localhost:4444/';
148+
var url = 'ws://localhost:4444/'+dop.name;
150149

151150
if (typeof options.url == 'string')
152151
url = options.url.replace('http','ws');
153152
else if (typeof window!='undefined' && /http/.test(window.location.href)) {
154153
var domain_prefix = /(ss|ps)?:\/\/([^\/]+)\/?(.+)?/.exec(window.location.href),
155154
protocol = domain_prefix[1] ? 'wss' : 'ws';
156-
url = protocol+'://'+domain_prefix[2].toLocaleLowerCase()+'/';
155+
url = protocol+'://'+domain_prefix[2].toLocaleLowerCase()+'/'+dop.name;
157156
}
158157

159158
var socket = new options.transport.api(url),
@@ -1038,7 +1037,7 @@ dop.core.listener = function(args) {
10381037
this.transport = this.options.transport.apply(this, args);
10391038
};
10401039
// Inherit emitter
1041-
Object.assign(dop.core.listener.prototype, dop.util.emitter.prototype);
1040+
dop.util.merge(dop.core.listener.prototype, dop.util.emitter.prototype);
10421041

10431042

10441043

@@ -1056,7 +1055,7 @@ dop.core.node = function() {
10561055
this.requests_queue = [];
10571056
};
10581057
// Inherit emitter
1059-
Object.assign(dop.core.node.prototype, dop.util.emitter.prototype);
1058+
dop.util.merge(dop.core.node.prototype, dop.util.emitter.prototype);
10601059

10611060

10621061

@@ -2466,7 +2465,7 @@ dop.protocol.instructions = {
24662465
// [-1234, 0, [<object_id>, 'path']]
24672466

24682467
// Subscriptor -> Owner
2469-
unsubscribe: 3, // [ 1234, 3, <object_id>] // If object_id is negative means is unsubscribing his own object
2468+
unsubscribe: 3, // [ 1234, 3, <object_id>]
24702469
// [-1234, 0]
24712470

24722471
// Subscriptor -> Owner

dist/browser.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/nodejs.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ var dop = {
2121
// src
2222
util: {},
2323
core: {},
24-
protocol: {},
25-
transport: {listen:{}, connect:{}}
24+
protocol: {}
2625
};
2726

2827

@@ -47,7 +46,7 @@ dop.connect = function(options) {
4746
options = args[0] = {};
4847

4948
if (typeof options.transport != 'function')
50-
options.transport = require('dop-transports').connect.websocket;
49+
options.transport = require('dop-transports').connect.ws;
5150

5251
return dop.core.connector(args);
5352
};
@@ -71,7 +70,7 @@ dop.listen = function(options) {
7170
options = args[0] = {};
7271

7372
if (typeof options.transport != 'function')
74-
options.transport = require('dop-transports').listen.websocket;
73+
options.transport = require('dop-transports').listen.ws;
7574

7675
if (typeof options.try_connects != 'number' || options.try_connects<0)
7776
options.try_connects = 99;
@@ -924,7 +923,7 @@ dop.core.listener = function(args) {
924923
this.transport = this.options.transport.apply(this, args);
925924
};
926925
// Inherit emitter
927-
Object.assign(dop.core.listener.prototype, dop.util.emitter.prototype);
926+
dop.util.merge(dop.core.listener.prototype, dop.util.emitter.prototype);
928927

929928

930929

@@ -942,7 +941,7 @@ dop.core.node = function() {
942941
this.requests_queue = [];
943942
};
944943
// Inherit emitter
945-
Object.assign(dop.core.node.prototype, dop.util.emitter.prototype);
944+
dop.util.merge(dop.core.node.prototype, dop.util.emitter.prototype);
946945

947946

948947

@@ -2352,7 +2351,7 @@ dop.protocol.instructions = {
23522351
// [-1234, 0, [<object_id>, 'path']]
23532352

23542353
// Subscriptor -> Owner
2355-
unsubscribe: 3, // [ 1234, 3, <object_id>] // If object_id is negative means is unsubscribing his own object
2354+
unsubscribe: 3, // [ 1234, 3, <object_id>]
23562355
// [-1234, 0]
23572356

23582357
// Subscriptor -> Owner

src/core/constructors/listener.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ dop.core.listener = function(args) {
77
this.transport = this.options.transport.apply(this, args);
88
};
99
// Inherit emitter
10-
Object.assign(dop.core.listener.prototype, dop.util.emitter.prototype);
10+
dop.util.merge(dop.core.listener.prototype, dop.util.emitter.prototype);

src/core/constructors/node.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ dop.core.node = function() {
99
this.requests_queue = [];
1010
};
1111
// Inherit emitter
12-
Object.assign(dop.core.node.prototype, dop.util.emitter.prototype);
12+
dop.util.merge(dop.core.node.prototype, dop.util.emitter.prototype);
1313

1414

1515

src/env/browser/websocket.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11

22
var connectWebsocket = function websocket(dop, node, options) {
33

4-
var url = 'ws://localhost:4444/';
4+
var url = 'ws://localhost:4444/'+dop.name;
55

66
if (typeof options.url == 'string')
77
url = options.url.replace('http','ws');
88
else if (typeof window!='undefined' && /http/.test(window.location.href)) {
99
var domain_prefix = /(ss|ps)?:\/\/([^\/]+)\/?(.+)?/.exec(window.location.href),
1010
protocol = domain_prefix[1] ? 'wss' : 'ws';
11-
url = protocol+'://'+domain_prefix[2].toLocaleLowerCase()+'/';
11+
url = protocol+'://'+domain_prefix[2].toLocaleLowerCase()+'/'+dop.name;
1212
}
1313

1414
var socket = new options.transport.api(url),

src/env/nodejs/connect.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ dop.connect = function(options) {
77
options = args[0] = {};
88

99
if (typeof options.transport != 'function')
10-
options.transport = require('dop-transports').connect.websocket;
10+
options.transport = require('dop-transports').connect.ws;
1111

1212
return dop.core.connector(args);
1313
};

src/env/nodejs/listen.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ dop.listen = function(options) {
77
options = args[0] = {};
88

99
if (typeof options.transport != 'function')
10-
options.transport = require('dop-transports').listen.websocket;
10+
options.transport = require('dop-transports').listen.ws;
1111

1212
if (typeof options.try_connects != 'number' || options.try_connects<0)
1313
options.try_connects = 99;

src/protocol/instructions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ dop.protocol.instructions = {
3838
// [-1234, 0, [<object_id>, 'path']]
3939

4040
// Subscriptor -> Owner
41-
unsubscribe: 3, // [ 1234, 3, <object_id>] // If object_id is negative means is unsubscribing his own object
41+
unsubscribe: 3, // [ 1234, 3, <object_id>]
4242
// [-1234, 0]
4343

4444
// Subscriptor -> Owner

0 commit comments

Comments
 (0)