MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / constructor

Method constructor

modules/network/websocket/websocket.js:51–71  ·  view source on GitHub ↗
(dictionary)

Source from the content-addressed store, hash-verified

49
50export class Client {
51 constructor(dictionary) {
52 // port, host, address, path (everything after port)
53 this.path = dictionary.path ?? "/";
54 this.host = dictionary.host ?? dictionary.address;
55 this.headers = dictionary.headers ?? [];
56 this.protocol = dictionary.protocol;
57 this.state = 0;
58 this.flags = 0;
59
60 if (dictionary.socket)
61 this.socket = dictionary.socket;
62 else {
63 dictionary.port ??= 80;
64 if (dictionary.Socket)
65 this.socket = new dictionary.Socket(Object.assign({}, dictionary.Socket, dictionary));
66 else
67 this.socket = new Socket(dictionary);
68 }
69 this.socket.callback = callback.bind(this);
70 this.doMask = true;
71 }
72
73 write(message) {
74 //@@ implement masking

Callers

nothing calls this directly

Calls 1

bindMethod · 0.45

Tested by

no test coverage detected