Skip to content

Instantly share code, notes, and snippets.

View bricecarpentier's full-sized avatar

Brice Carpentier bricecarpentier

View GitHub Profile
function maybe(fn) {
try {
return fn();
} catch(error) {
if (error instanceof TypeError) {
return undefined;
}
throw error;
}
}
@bricecarpentier
bricecarpentier / websocket-nodejs-redis-server.js
Last active March 29, 2021 21:12
This is a simple websocket server coded using nodejs and http://einaros.github.io/ws/ connecting to a redis pubsub channel and sending messages to selected clients
var ws = require('ws'),
nconf = require('nconf'),
redis = require('redis');
nconf.argv()
.env();
var server = new ws.Server({port: nconf.get('PORT')});
var sockets = {};
package
{
import flash.display.Sprite;
import com.worlize.websocket.WebSocket;
import com.worlize.websocket.WebSocketEvent;
import com.worlize.websocket.WebSocketErrorEvent;
public class Main extends Sprite