mirror of
https://github.com/overleaf/overleaf.git
synced 2024-10-31 21:21:03 -04:00
31 lines
1.1 KiB
CoffeeScript
31 lines
1.1 KiB
CoffeeScript
AuthenticationController = require("./Features/Authentication/AuthenticationController")
|
|
MessageController = require("./Features/Messages/MessageController")
|
|
RoomController = require("./Features/Rooms/RoomController")
|
|
MessageHttpController = require('./Features/Messages/MessageHttpController')
|
|
|
|
module.exports = Router =
|
|
route: (app, io) ->
|
|
|
|
app.get "/room/:project_id/messages", MessageHttpController.getMessages
|
|
app.post "/room/:project_id/messages", MessageHttpController.sendMessage
|
|
|
|
app.get "/status", (req, res, next) ->
|
|
res.send("chat is alive")
|
|
|
|
io.sockets.on "connection", (client) ->
|
|
client.on "disconnect", () ->
|
|
RoomController.leaveAllRooms(client)
|
|
|
|
client.on "auth", (data, callback = (error) ->) ->
|
|
AuthenticationController.authClient(client, data, callback)
|
|
|
|
client.on "joinRoom", (data, callback = (error) ->) ->
|
|
RoomController.joinRoom(client, data, callback)
|
|
|
|
client.on "sendMessage", (data, callback = (error) ->) ->
|
|
MessageController.sendMessage(client, data, callback)
|
|
|
|
client.on "getMessages", (data, callback = (error) ->) ->
|
|
MessageController.getMessages(client, data, callback)
|
|
|
|
|