Permalink
Browse files

try reconnecting to campfire on a per room basis when streams close

  • Loading branch information...
atmos committed Nov 25, 2011
1 parent 73efe3a commit ec5a3358e5d5015b4d0c130772ce5138516dcafe
Showing with 8 additions and 2 deletions.
  1. +8 −2 src/adapters/campfire.coffee
@@ -55,6 +55,10 @@ class Campfire extends Adapter
bot.Room(roomId).join (err, callback) ->
bot.Room(roomId).listen()
+ bot.on "reconnect", (roomId) =>
+ bot.Room(roomId).join (err, callback) ->
+ bot.Room(roomId).listen()
+
@bot = bot
exports.use = (robot) ->
@@ -159,8 +163,10 @@ class CampfireStreaming extends EventEmitter
@robot.logger.error "Campfire error: #{err}"
response.on "end", =>
- @robot.logger.error "Streaming connection closed. :("
- process.exit(1)
+ @robot.logger.error "Streaming connection closed for room #{id}. :("
+ setTimeout (->
+ self.emit "reconnect", id
+ ), 5000
response.on "error", (err) =>
@robot.logger.error "Campfire response error: #{err}"

0 comments on commit ec5a335

Please sign in to comment.