0.0.6 • Published 11 years ago

blackmonkey v0.0.6

Weekly downloads
3
License
-
Repository
github
Last release
11 years ago

blackmonkey

A chat module built with node.js using socket.io.

This is currently in development stage, and the following features will be added:

  • Whisper support
  • Ban List

###How to Use

####Server side

// Include the things we need

var express = require('express');
var io = require('socket.io');
var http = require('http');
var blackmonkey = require('./blackmonkey.js');

// Create the express app that serves static pages

var app = express();
app.use("/", express.static(__dirname + '/public/'));

// Get the http server from the app

var server = http.createServer(app);

// Have the server listen to port 8000

server.listen(8000);
console.log('Listening on port 8000');

// Pass variables into blackmonkey

blackmonkey.setServer(server);
blackmonkey.setSocket(io);

// Start blackmonkey

blankmonkey.initChat();

####Client Side

// Create a socket

var socket = io.connect('/');

// Create a blackmonkey instance and pass a socket into the constructor

angrymonkey = new blackmonkey(socket);

// Set up a callback everytime someone posts a message

angrymonkey.onNewMessage(function(data){
	console.log(data.message);
});

if(userSubmitsAChatMessage){
	// Post the message
	angrymonkey.postMessage($('#chatMessageBox').val());
}

// Begin the chat

angrymonkey.initChat();
0.0.6

11 years ago

0.0.5

11 years ago

0.0.4

11 years ago

0.0.3

11 years ago

0.0.2

11 years ago

0.0.1

11 years ago