Skip to content

a web interface and API to monitor / manage socketio connections

Notifications You must be signed in to change notification settings

trickpattyFH20/socketio-interface

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

socketio-interface

socketio-interface is a web interface and API to monitor / manage socketio connections

Install

npm i --save socketio-interface

Implement

var socketInterface = require('socketio-interface');
socketInterface(io[, config]);

Config

the config argument supports the following properties:

  • password: (String) Defaults to: "toor"
  • port: (Number) Defaults to: 13333
  • ssl: (Object) Defaults to: null
    • key: String
    • cert: String
    • port: Number

Use

The web interface will be hosted at the same domain/host as your socket.io instance on port 13333 (or the port you specify).

If you are working locally, start your socket.io server and then visit http://localhost:13333/sockets/json

Endpoints

/sockets/total
/sockets/json
/sockets/:id
/sockets/:id/uptime

/rooms/total
/rooms/json

Example

this is an example how you could implement socketio-interface on top of the official socket.io chat example:

var app = require('express')();
var http = require('http').Server(app);
var io = require('socket.io')(http);
var port = process.env.PORT || 3000;
var socketInterface = require('socketio-interface')(io);

app.get('/', function(req, res){
  res.sendFile(__dirname + '/index.html');
});

io.on('connection', function(socket){
  socket.on('chat message', function(msg){
    io.emit('chat message', msg);
  });
});

http.listen(port, function(){
  console.log('listening on *:' + port);
});

About

a web interface and API to monitor / manage socketio connections

Resources

Stars

Watchers

Forks

Packages

No packages published