{"action":"created","issue":{"url":"https://api.github.com/repos/amekkawi/express-ws-routes/issues/2","labels_url":"https://api.github.com/repos/amekkawi/express-ws-routes/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/amekkawi/express-ws-routes/issues/2/comments","events_url":"https://api.github.com/repos/amekkawi/express-ws-routes/issues/2/events","html_url":"https://github.com/amekkawi/express-ws-routes/issues/2","id":127044957,"number":2,"title":"TypeError: router.websocket is not a function ","user":{"login":"ehsanzaffar","id":8422606,"avatar_url":"https://avatars.githubusercontent.com/u/8422606?v=3","gravatar_id":"","url":"https://api.github.com/users/ehsanzaffar","html_url":"https://github.com/ehsanzaffar","followers_url":"https://api.github.com/users/ehsanzaffar/followers","following_url":"https://api.github.com/users/ehsanzaffar/following{/other_user}","gists_url":"https://api.github.com/users/ehsanzaffar/gists{/gist_id}","starred_url":"https://api.github.com/users/ehsanzaffar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ehsanzaffar/subscriptions","organizations_url":"https://api.github.com/users/ehsanzaffar/orgs","repos_url":"https://api.github.com/users/ehsanzaffar/repos","events_url":"https://api.github.com/users/ehsanzaffar/events{/privacy}","received_events_url":"https://api.github.com/users/ehsanzaffar/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-01-16T18:39:27Z","updated_at":"2016-01-22T04:38:00Z","closed_at":null,"body":"I am unable to add another route to my existing express app I changed my app.js to include following code \r\n```\r\nvar express = require('express');\r\n...\r\nvar wstest = require('./routes/tracingtest');\r\n...\r\n//var app = express();\r\nvar app = require('express-ws-routes')();\r\n...\r\napp.use('/wstest', wstest);\r\n```\r\n\r\nand my route file tracingtest.js looks like\r\n```\r\nvar express = require('express');\r\nvar router = express.Router();\r\n\r\nrouter.websocket('/', function(info, cb, next) {\r\n\tcb(function(socket) {\r\n\t\tsocket.send('connected!');\r\n\t});\r\n});\r\n```\r\n\r\nBut when I Start the app I get this Error\r\n```\r\n/home/ehsan/n_ode/trace_student/routes/tracingtest.js:4\r\nrouter.websocket('/', function(info, cb, next) {\r\n       ^\r\nTypeError: router.websocket is not a function\r\n    at Object.<anonymous> (/home/ehsan/n_ode/trace_student/routes/tracingtest.js:4:8)\r\n    at Module._compile (module.js:435:26)\r\n    at Object.Module._extensions..js (module.js:442:10)\r\n    at Module.load (module.js:356:32)\r\n    at Function.Module._load (module.js:313:12)\r\n    at Module.require (module.js:366:17)\r\n    at require (module.js:385:17)\r\n    at Object.<anonymous> (/home/ehsan/n_ode/trace_student/app.js:13:14)\r\n    at Module._compile (module.js:435:26)\r\n    at Object.Module._extensions..js (module.js:442:10)\r\n    at Module.load (module.js:356:32)\r\n    at Function.Module._load (module.js:313:12)\r\n    at Module.require (module.js:366:17)\r\n    at require (module.js:385:17)\r\n    at Object.<anonymous> (/home/ehsan/n_ode/trace_student/bin/www:7:11)\r\n    at Module._compile (module.js:435:26)\r\n```"},"comment":{"url":"https://api.github.com/repos/amekkawi/express-ws-routes/issues/comments/173804504","html_url":"https://github.com/amekkawi/express-ws-routes/issues/2#issuecomment-173804504","issue_url":"https://api.github.com/repos/amekkawi/express-ws-routes/issues/2","id":173804504,"user":{"login":"amekkawi","id":1475229,"avatar_url":"https://avatars.githubusercontent.com/u/1475229?v=3","gravatar_id":"","url":"https://api.github.com/users/amekkawi","html_url":"https://github.com/amekkawi","followers_url":"https://api.github.com/users/amekkawi/followers","following_url":"https://api.github.com/users/amekkawi/following{/other_user}","gists_url":"https://api.github.com/users/amekkawi/gists{/gist_id}","starred_url":"https://api.github.com/users/amekkawi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amekkawi/subscriptions","organizations_url":"https://api.github.com/users/amekkawi/orgs","repos_url":"https://api.github.com/users/amekkawi/repos","events_url":"https://api.github.com/users/amekkawi/events{/privacy}","received_events_url":"https://api.github.com/users/amekkawi/received_events","type":"User","site_admin":false},"created_at":"2016-01-22T04:38:00Z","updated_at":"2016-01-22T04:38:00Z","body":"Also, if your application requires you to create the detached routers before creating the express app, see the [Manual Setup](https://github.com/amekkawi/express-ws-routes#manual-setup) section in the docs.\r\n\r\nFor example...\r\n```javascript\r\nvar expressWs = require('express-ws-routes');\r\n\r\n// Add websocket support to express (returns the express instance for convenience)\r\nvar express = expressWs.extendExpress();\r\n\r\n// Get the router before creating the app itself\r\nvar wstest = require('./routes/tracingtest');\r\n\r\n// Create the express app\r\nva app = express();\r\n\r\n// Attach the router to the app\r\napp.use('/wstest', wstest);\r\n\r\nvar server = http.createServer(app);\r\nserver.wsServer = expressWs.createWebSocketServer(server, app);\r\nserver.listen(8080, function() {\r\n    console.log('Server listening on port 8080...');\r\n});\r\n```"}}