Skip to content
This repository has been archived by the owner on Feb 14, 2018. It is now read-only.

Commit

Permalink
cleanup broken streams
Browse files Browse the repository at this point in the history
  • Loading branch information
WardCunningham committed Dec 29, 2012
1 parent 5b3f72d commit 04b5d65
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion client/plugins/logwatch/logwatch.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ window.plugins.logwatch =

socket.onmessage = (e) ->
msg = JSON.parse e.data
print wiki.resolveLinks("[[#{msg.title}]]")
print wiki.resolveLinks("[[#{msg.title}]] #{msg.listeners}")

socket.onclose = ->
print "WebSocket Connection Closed."
2 changes: 1 addition & 1 deletion client/plugins/logwatch/logwatch.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions server/express/lib/server.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,15 @@ module.exports = exports = (argv) ->
)
)
logWatchSocket.on('connection', (ws) ->
logWatchSocket.on('fetch', (page) ->
logWatchSocket.on('fetch', fetchListener = (page) ->
reference =
title: page.title
listeners: logWatchSocket.listeners('fetch').length
ws.send JSON.stringify(reference), (e) ->
if e
log 'unable to send ws message: ', e
return
logWatchSocket.removeListener 'fetch', fetchListener
ws.close()
)
ws.on('message', (message) ->
log 'logWatch message from client:', message
Expand Down

0 comments on commit 04b5d65

Please sign in to comment.