jarohen / chord

A library designed to bridge the gap between the triad of CLJ/CLJS, web-sockets and core.async.
439 stars 40 forks source link

Node.js #44

Closed eneroth closed 7 years ago

eneroth commented 8 years ago

Would it be possible to use Node.js as server somehow? Or is my best bet to use something Node-native, like Socket.io?

jarohen commented 8 years ago

Hi Henrik - I don't know I'm afraid! I've not really ever used Node, either through JS or compiled CLJS, sorry! Could take a look into what Node has in the way of an API we could wrap - do you know of anything?

heads to Google

Cheers,

James

eneroth commented 8 years ago

Well, I don't imagine it would be that much work if socket.io was used, for example. This is how you set up a listener with socket.io:

io.on('connection', function (socket) {
  socket.emit('news', { hello: 'world' });
  socket.on('my other event', function (data) {
    console.log(data);
  });
});

In fact, since chord doesn't support Node, I'll probably just write a core.async wrapper around that :-) Of course, in supporting Transit and so on, it gets a little bit more complicated, but most of that code should already be present in your client code.

jarohen commented 7 years ago

Fixed by #54, in the 0.8.1 release - thanks @ageneau!