export const message = (client: Socket, io: socketIO.Server) => { client.on('message', (payload: {from: string, body: string}) => { console.log('Received message >| ', payload.body); io.emit('new-message', payload); }); }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter