开发者

django + orbited/stomp

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 so开发者_如何学编程meone's connection closes. Unfortunetly there was no explanation how to do that. Anyone knows the answer?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜