Comments (3)
You can get a reference to your zappa application with myapp = app 'myapp'
.
When your app is started, if you defined any at
or msg
handlers, socket.io will be initialized and you'll be able to access it at myapp.ws_server
.
But since it is only created when your app starts, you will not be able to see it at the root scope.
I'm not sure though what is it that you're trying to achieve with the code you pasted here. If you could tell me what your final goal is, maybe I can show you another way of achieving it without resorting to accessing socket.io directly.
from zappa.
Basically we're instantiating a game engine inside our zappa "app" and have timers which push events to clients outside of the express/socket.io (get, at, msg) hooks provided by zappa.
So we need to be able to reference the socket.io "server" to broadcast events but I couldn't find a way to do this without creating the "registry" like I have in the code above...
from zappa.
In 0.2.0beta you have access to the socket.io server as io
at the root and handler scopes.
The zappa function also returns it so you can use it from the outside. Ex.:
chat = require('zappa') ->
# chat code here
console.log chat.app # express server
console.log chat.io # socket.io server
from zappa.
Related Issues (20)
- Unable to include files in templates HOT 1
- Can I use tobi with zappa?
- Using client-side routes with zappa/sammy HOT 2
- Zappa 0.3.1 doesn't work with node 0.6.0 HOT 5
- Getting ENOENT Error from npm
- Adding the ContextID to a template name breaks Jade template extension HOT 1
- Error with npm on node 0.6.2
- Getting 404 when trying to serve static image
- `@enable 'serve *'` does nothing -- documentation disparity? HOT 2
- HTTPS?
- 500 error failing to find view template
- node uuid 1.2.0 not found.. latest being 1.3.3 HOT 3
- /zappa/src/../vendor/jquery-1.6.4.min.js missing HOT 2
- Still Alive? -> Yes: zappajs :) HOT 4
- Cannot read property 'prototype' of undefined HOT 13
- Content negotiation
- Tests are broken
- [issue closed]
- Zappa and node 0.5.x HOT 3
- Can't npm install zappa HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from zappa.