MCPcopy Create free account
hub / github.com/msgbyte/tailchat / createIO

Function createIO

client/test/client.ts:6–46  ·  view source on GitHub ↗
(authToken: string)

Source from the content-addressed store, hash-verified

4const uri = 'http://127.0.0.1:11000';
5
6function createIO(authToken: string) {
7 const socket = io(uri, {
8 transports: ['websocket'],
9 forceNew: true,
10 auth: {
11 token: authToken,
12 },
13 });
14
15 // client-side
16 socket.on('connect', () => {
17 socket.emit(
18 'debug.echo',
19 {
20 name: 'moonrailgun',
21 },
22 (d) => {
23 console.log(d);
24 }
25 );
26 });
27
28 socket.on('disconnect', () => {
29 console.log(socket.id); // undefined
30 });
31
32 socket.on('connect_error', (err) => {
33 console.log('connect_error', err.message);
34 });
35
36 socket.io.on('error', () => {
37 console.log('error');
38 });
39
40 socket.onAny((eventName: string, eventData: unknown) => {
41 console.log({
42 eventName,
43 eventData,
44 });
45 });
46}
47
48fetch('http://127.0.0.1:11000/api/user/login', {
49 headers: {

Callers 1

client.tsFile · 0.85

Calls 3

onMethod · 0.80
emitMethod · 0.65
logMethod · 0.65

Tested by

no test coverage detected