on master help sign in
2 files changed+10
since splitsnapshots
unifiedsplit
Sources/App/configure.swift+6 Sources/App/routes.swift+4
Sources/App/configure.swift+6
@@ -54,6 +54,12 @@ public func configure(_ config: inout Config, _ env: inout Environment, _ servic
5454 }
5555 }
5656
57+ ws.get("test") { (ws, req) in
58+ ws.onText({ (ws, text) in
59+ ws.send("pong")
60+ })
61+ }
62+
5763 services.register(ws, as: WebSocketServer.self)
5864
5965}
Sources/App/routes.swift+4
@@ -16,6 +16,10 @@ public func routes(_ router: Router) throws {
1616 return postModel.getPost(for: try req.parameters.next(Int.self), on: req)
1717 }
1818
19+ router.get("openSockets") { (req) in
20+ return OpenSockets.sockets.count
21+ }
22+
1923 // Example of configuring a controller
2024 let todoController = TodoController()
2125 router.get("todos", use: todoController.index)