Last active
August 29, 2015 13:57
-
-
Save m4tthumphrey/9553977 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require dirname(__DIR__) . '/vendor/autoload.php'; | |
$chat = new \MyApp\Chat(); | |
$app = new \Ratchet\App(); | |
$app->route('/test', $chat); | |
$app->run(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var app = require('http').createServer(handler) | |
, io = require('socket.io').listen(app) | |
, fs = require('fs') | |
app.listen(8000); | |
function handler (req, res) { | |
console.log(req.url); | |
io.sockets.emit('news', { debug: 'boo'} ); | |
res.writeHead(200); | |
res.end('boo'); | |
} | |
io.sockets.on('connection', function (socket) { | |
socket.emit('news', { hello: 'world' }); | |
socket.on('my other event', function (data) { | |
console.log(data); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment