forked from nteract/enchannel-zmq-backend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjmp.ts
More file actions
50 lines (43 loc) · 1.17 KB
/
jmp.ts
File metadata and controls
50 lines (43 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import { EventEmitter } from "events";
import * as jmp from "@runtimed/jmp";
class Socket extends EventEmitter {
throttle = false;
constructor(public type: any, public scheme: any, public key: any) {
super();
}
monitor() {}
unmonitor() {}
connect() {
if (this.throttle) {
setTimeout(() => this.emit("connect"), 0);
} else {
this.emit("connect");
}
}
close() {}
}
interface MessageProperties {
idents: any[];
header: object;
parent_header: object;
metadata: object;
content: object;
buffers: Uint8Array | null;
}
class Message {
idents: any[];
header: object;
parent_header: object;
metadata: object;
content: object;
buffers: Uint8Array | null;
constructor(properties: Partial<MessageProperties>) {
this.idents = (properties && properties.idents) || [];
this.header = (properties && properties.header) || {};
this.parent_header = (properties && properties.parent_header) || {};
this.metadata = (properties && properties.metadata) || {};
this.content = (properties && properties.content) || {};
this.buffers = (properties && properties.buffers) || new Uint8Array();
}
}
export { Message, Socket };