From f00ba92ed2cc1a9c24ad783e83525d1b5a85b857 Mon Sep 17 00:00:00 2001 From: tomsmeding Date: Tue, 13 Sep 2016 11:43:06 +0200 Subject: Initial --- modules/poke/poke.html | 125 +++++++++++++++++++++++++++++++++++++++++++++++++ modules/poke/poke.js | 47 +++++++++++++++++++ 2 files changed, 172 insertions(+) create mode 100644 modules/poke/poke.html create mode 100644 modules/poke/poke.js (limited to 'modules/poke') diff --git a/modules/poke/poke.html b/modules/poke/poke.html new file mode 100644 index 0000000..de9ce1f --- /dev/null +++ b/modules/poke/poke.html @@ -0,0 +1,125 @@ + + + + +Poke + + + + + + + + +
+

Users

+
    +
    +

    Notifications

    +
      +
      + + + \ No newline at end of file diff --git a/modules/poke/poke.js b/modules/poke/poke.js new file mode 100644 index 0000000..af0285d --- /dev/null +++ b/modules/poke/poke.js @@ -0,0 +1,47 @@ +var cmn=require("../$common.js"), + fs=require("fs"), + Naampje=require("naampje").name; + +var conns=[]; + +var uniqid=(function(){ + var id=0; + return function(){return id++;}; +})(); + +module.exports=function(app,io,moddir){ + var ioNsp=io.of("/poke"); + app.get("/poke",function(req,res){ + res.sendFile(moddir+"/poke.html"); + }); + ioNsp.on("connection",function(socket){ + var id=uniqid(); + var nick=Naampje(); + var status=""; + socket.emit("reset",null); + socket.emit("self",{id:id,nick:nick}); + conns.forEach(function(c){ + socket.emit("connection add",{id:c.id,nick:c.nick}); + socket.emit("status",{id:c.id,status:c.status}); + }); + ioNsp.emit("connection add",{id:id,nick:nick}); + conns.push({id:id,nick:nick,status:"",socket:socket}); + socket.on("disconnect",function(){ + for(var i=0;i