Created
December 3, 2014 16:42
-
-
Save apoca/9bc27d7cbb1c3a216e79 to your computer and use it in GitHub Desktop.
This file contains 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 http = require('http'); | |
var https = require('https'); | |
var fs = require('fs'); | |
var socket = require('socket.io'); | |
var express = require('express'); | |
var app = express(); | |
var port = 3000; | |
var server = https.createServer(sslOptions, app).listen(port, function(){ | |
console.log('Listening on https://' + server.address().address + ':' + server.address().port); | |
}); | |
var io = socket.listen(server); | |
io.set('origins', '*:*'); | |
server.listen(port); | |
io.sockets.on('connection', function(client) { | |
console.log("New client!"); | |
client.on('stick', function(data) { | |
console.log('Stick notification ' + data.title + data.text); | |
client.broadcast.emit('stick', { | |
id : data.id, | |
title : data.title, | |
url : data.url, | |
text : data.text, | |
img : data.img | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment