Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var http = require('http');
- var io = require('socket.io');
- var loggly = require('loggly');
- var path = require('path');
- var paperboy = require('paperboy');
- var config = {
- subdomain: "geekceo",
- auth: {
- username: "kordless",
- password: "sexytime"
- }
- };
- var geekceo = loggly.createClient(config);
- terms = [];
- geekceo.facet('date', '404')
- .context({ buckets: 10 })
- .run(function (err, results) {
- });
- // Start the server at port 8080
- var server = http.createServer(function(req, res){
- paperboy.deliver(path.join(path.dirname(__filename), 'static'), req, res);
- });
- server.listen(80);
- // Create a Socket.IO instance, passing it our server
- var socket = io.listen(server);
- // Add a connect listener
- socket.on('connection', function(client){
- var ping = function() {
- client.send(Math.random());
- console.log("sending");
- }
- interval = setInterval(ping, 1000);
- // Success! Now listen to messages to be received
- client.on('message',function(event){
- console.log('Received message from client!',event);
- });
- client.on('disconnect',function(){
- clearInterval(interval);
- console.log('Server has disconnected');
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement