News for hackers. Stuff that matters.

bperel

Show HN: Socket-call – Call socket.io events like normal JavaScript functions

https://github.com/bperel/socket-call

Hello HN,I built a Typescript library (named socket-call, for lack of a more sexy name) whose goal is to be able to call socket.io events as regular functions.So you declare your server-side like so: ... const listenEvents = (services: UserServices) => ({ // Add your events here, the name of the event is the name of the function login: async (username: string) => { ...

( Read More... | 17 comments | on HN )
Yes, the link is wrong. The correct URL is https://github.com/bperel/socket-call
Indeed the link is wrong, thanks for the correction :-) Unfortunately I can't update my post

Show HN: Socket-call – Call socket.io events like normal JavaScript functions

https://github.com/bperel/socket

Hello HN,I built a Typescript library (named socket-call, for lack of a more sexy name) whose goal is to be able to call socket.io events as regular functions.So you declare your server-side like so:... const listenEvents = (services: UserServices) => ({ login: async (username: string) => { services._socket.data.user = { username }; console.log(`User ${username} logged in`); ...

( Read More... | 4 comments | 2 points | on HN )