MCPcopy
hub / github.com/alm-tools/alm / constructor

Method constructor

src/socketLib/socketLibClient.ts:34–54  ·  view source on GitHub ↗
(clientImplementation: any)

Source from the content-addressed store, hash-verified

32 public connectionStatusChanged = new TypedEvent<{connected:boolean}>();
33
34 constructor(clientImplementation: any) {
35 super();
36 this.socket = io.connect(origin);
37
38 // Also provide the following services to the server
39 this.registerAllFunctionsExportedFromAsResponders(clientImplementation);
40 this.startListening();
41
42 this.socket.on(anycastMessageName,(msg:CastMessage<any>)=>{
43 this.typedEvents[msg.message].emit(msg.data);
44 });
45
46 let connected = false;
47 setInterval(() => {
48 let newConnected = this.socket.connected;
49 if (newConnected != connected) {
50 connected = newConnected;
51 this.connectionStatusChanged.emit({ connected });
52 }
53 }, 2000);
54 }
55
56 private typedEvents:{[key:string]:TypedEvent<any>} = {};
57

Callers

nothing calls this directly

Calls 5

startListeningMethod · 0.80
connectMethod · 0.65
onMethod · 0.65
emitMethod · 0.65

Tested by

no test coverage detected