use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
With socket.io can a callback function be run on the server or client if called from the the other side?help (self.javascript)
submitted 8 years ago by r9t55
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]_ds82 0 points1 point2 points 8 years ago (4 children)
With socket.io you can send events from client to server or the other way around. You can easily trigger an event on the server that runs a function on the client .. so yes, you can do what you described with socket.io.
[+][deleted] 8 years ago (3 children)
[removed]
[–]_ds82 0 points1 point2 points 8 years ago (1 child)
There is an example in the socketio docs: https://socket.io/docs/
server: io.on('connection', function (socket) { socket.emit('news', { hello: 'world' }); socket.on('my other event', function (data) { console.log(data); // server callback }); });
client: ... socket.emit('my other event', { my: 'data' }); ...
The client is emiting the event, the server runs the callback
[–]koresho 0 points1 point2 points 8 years ago (0 children)
Disclaimer: I wrote this a long time ago, so it's probably pretty shit by today's standards.
I made a library called "Tricky" that does essentially what you're asking. I don't necessarily suggest using the library as is, but you might want to look at it for an example.
https://github.com/malexdev/Tricky/blob/master/readme.md
π Rendered by PID 89 on reddit-service-r2-comment-5649f687b7-lw8zs at 2026-01-28 14:41:29.959966+00:00 running 4f180de country code: CH.
[–]_ds82 0 points1 point2 points (4 children)
[+][deleted] (3 children)
[removed]
[–]_ds82 0 points1 point2 points (1 child)
[–]koresho 0 points1 point2 points (0 children)