Socket Events
triggerClientEvent
Method allowing to trigger a client event.
Parameter | Type | Description |
---|---|---|
eventName | string | Name of the event. |
data | {[key: string]: any;}) => Promise<void>) / undefined | Data content. |
Basic Usage
await I.triggerClientEvent(`test-event`, { a: 1, b: `test` });
handleClientEvent
Method allowing to handle a client event.
Parameter | Type | Description |
---|---|---|
eventName | string | Name of the event. |
fn | (data?: { [key: string]: any;}) => Promise<void>) | Data content. |
Basic Usage
await I.handleServerEvent(`test-event`, async (data) => {
console.log(`My message| ${data}`)
i++;
})
triggerServerEvent
Method allowing to trigger a server event.
Parameter | Type | Description |
---|---|---|
eventName | string | Name of the event. |
data | {[key: string]: any;}) => Promise<void>) / undefined | Data content. |
Usage Example
await I.triggerServerEvent(`test-event`, [`<= #Message is here !`]);
handleServerEvent
Method allowing to handle a server event.
Parameter | Type | Description |
---|---|---|
eventName | string | Name of the event. |
fn | (data?: { [key: string]: any;}) => Promise<void>) | Data content. |
Usage Example
await I.handleServerEvent(`test-event`, async (data) => {
console.log(`My message| ${data}`)
})