 				user = {_id: "anonymous-user"}
 
 			client.on "joinProject", (data = {}, callback) ->
+				if typeof callback != 'function'
+					return Router._handleInvalidArguments(client, 'joinProject', arguments)
+
 				if data.anonymousAccessToken
 					user.anonymousAccessToken = data.anonymousAccessToken
 				WebsocketController.joinProject client, user, data.project_id, (err, args...) ->

				logger.error attrs, "server side error in #{method}"
				# Don't return raw error to prevent leaking server side info
				return callback {message: "Something went wrong in real-time service"}

	configure: (app, io, session) ->
		app.set("io", io)

						callback(null, args...)

			client.on "leaveDoc", (doc_id, callback) ->
				if typeof callback != 'function'
					return Router._handleInvalidArguments(client, 'leaveDoc', arguments)

				WebsocketController.leaveDoc client, doc_id, (err, args...) ->
					if err?
						Router._handleError callback, err, client, "leaveDoc"
