jimguys/poemlab — pull request #49 by marclitchfield (2013-10-12 16:47:58+00:00)
Title: Socket.io rooms and Poet Authorization

Resolve issues #28 and #41

Introduce socket.io "rooms". The client sends a joinRoom event to the server, and if the poet has access to the poem, the server joins the client in the room for the poem. This gives us better isolation between poems, because line submissions are not broadcasted to all connected users.

Introduce isPoetInPoem function on PoetsRepository to check if the poet has access to the poem. There is a middleware function created by the AuthenticationService that is connected to the poem edit and line create routes to ensure poets are authorized for those actions. The name of the poemId parameter varies, so it is specified to the function that generates the middleware.

Start using process.emit for error handling instead of scattering console.error statements throughout the codebase. This completely consolidates how errors are handled.