cayblood / batman-rails-chat-app

Simple chat app made with a rails REST backend and a backbone.js frontend.
1 stars 1 forks source link

Where to clearInterval ? #1

Open guiceolin opened 12 years ago

guiceolin commented 12 years ago

Hello there,

it will not be exactly an issue, but a discussion..

where to clear up the timeout? im doing an chat inside my project, using batmanjs, and i have more than one channel( like irc , or conversations, like facebook ). so, when im on show of an determinated conversation, i want to poll JUST THIS conversation. and when i change from this conversation to another, i need to stop this polling, and start another one.

how do you would do that ?

(sorry about my bad english, i'm trying to get it better)

cayblood commented 12 years ago

Hey sorry but somehow I didn't notice your message until now. You'll notice that my app makes ajax calls to /highest_message_id to see if it needs to make another ajax call. One simple way of making this work for multiple chat rooms would be to modify the highest_message_id call so that you pass into it the id of the chat room you're in so that it only gives you the highest id for that particular room. This would not scale well for many chat rooms but it would work for a small number of rooms.

guiceolin commented 12 years ago

Hum. thats ok for me. but you never called clearInterval(). if my app has 2 or 3 rooms, i need to call clearInterval, and call another setInterval, based in room that user is. i dont know where to call this clearInterval. it has an after-change-action callback, for controller? because chat system is only one little piece of my system, and i can get out of chat, and in this point, i need to clearInterval().

sorry, my english is not realy good, maybe you cant understand what im try to say.

On Sun, Sep 9, 2012 at 10:30 AM, Carl Youngblood notifications@github.comwrote:

Hey sorry but somehow I didn't notice your message until now. You'll notice that my app makes ajax calls to /highest_message_id to see if it needs to make another ajax call. One simple way of making this work for multiple chat rooms would be to modify the highest_message_id call so that you pass into it the id of the chat room you're in so that it only gives you the highest id for that particular room. This would not scale well for many chat rooms but it would work for a small number of rooms.

— Reply to this email directly or view it on GitHubhttps://github.com/cayblood/batman-rails-chat-app/issues/1#issuecomment-8403657.

Guilherme A. Ceolin Rails Developer

cayblood commented 12 years ago

Perhaps you can call clearInterval whenever the user clicks on the link that would take him/her to a new chat room.

On Mon, Sep 10, 2012 at 2:33 PM, guiceolin notifications@github.com wrote:

Hum. thats ok for me. but you never called clearInterval(). if my app has 2 or 3 rooms, i need to call clearInterval, and call another setInterval, based in room that user is. i dont know where to call this clearInterval. it has an after-change-action callback, for controller? because chat system is only one little piece of my system, and i can get out of chat, and in this point, i need to clearInterval().

sorry, my english is not realy good, maybe you cant understand what im try to say.

On Sun, Sep 9, 2012 at 10:30 AM, Carl Youngblood notifications@github.comwrote:

Hey sorry but somehow I didn't notice your message until now. You'll notice that my app makes ajax calls to /highest_message_id to see if it needs to make another ajax call. One simple way of making this work for multiple chat rooms would be to modify the highest_message_id call so that you pass into it the id of the chat room you're in so that it only gives you the highest id for that particular room. This would not scale well for many chat rooms but it would work for a small number of rooms.

— Reply to this email directly or view it on GitHub< https://github.com/cayblood/batman-rails-chat-app/issues/1#issuecomment-8403657>.

Guilherme A. Ceolin Rails Developer

— Reply to this email directly or view it on GitHubhttps://github.com/cayblood/batman-rails-chat-app/issues/1#issuecomment-8421919.