Question

I'm using django server together with orbited/stomp server to write something like chat. Assume that some users are connected to orbited. When one of them disconnects from orbited, how can I notify the rest? I mean I've tried the following code (javascript on the client side - maybe this is already wrong, server should do the push, right?):

function end()
{
  stomp.send('user killed', '/channel');
}

together with

stomp.onclose = end;

but this doesn't work at all. Then I used

window.onbeforeunload = end;

but again no visible effect. I also replaced end() with different function, which just do ajax post to django server. But then stomp.onclose again does nothing and window.onbeforeunload gives me a broken pipe.

So these were attempts to implement "client leaves message before qutting" idea. But that failed.

I'm not even sure whether I'm doing this right. Is there a way to notify orbited/stomp users about leaving of a user? All ideas would be appreciated.

EDIT: Maybe there's antother way. I've read that it is possible to configure orbited server to make an http callback to the application with the user's key when someone's connection closes. Unfortunetly there was no explanation how to do that. Anyone knows the answer?

Was it helpful?

Solution

It seems that orbited is not suited for this kind of things (I talked with orbited creator). I switched to hookbox and it works fine.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top