API

- API - Install Guide - About Nebulosa - GitHub repo -

This page is pretty long, here's some anchor links to help you:
- Make your own Nebulosa client
- Authentication
- Events

Make your own Nebulosa client

Using a Server/Client architecture, Nebulosa is very flexible when it comes to abstraction.

If you don't like the default Web Interface.. no problem, you can create your own theme or even your separated client!

All you need to create a client is a working Socket.IO client library, you can find a list of libraries for various well-known programming languages by clicking here.

Authentication

Nebulosa server can be protected and Socket.IO will require you to provide username and password if needed.

The only way to know beforehand if it's going to require credentials is to do a GET request to /useAuth which will return either true or false if either authentication is enabled or not.

Credentials are provided when establishing a connection, the main (and secure) way to provide credentials is through the Cookie HTTP Header.
Just set Cookie to "user=<Username>&pass=<Password>" in the connection request and you're good to go. You will receive an "handshake unauthorized" error if you didn't provide credential or if they were wrong.

If you can't access Cookies for some reason you can fallback to querystrings, as usual, set "user=<Username>&pass=<Password>" as the connection querystring and you'll receive an error if the credentials are wrong

Events

You will receive various type of events depending on what happens. I will refer to the passed data (which is usually an Object) as Object

networks Received when connected, it contains all the network/channel/user data in the following structure:

Object = { 
	network1: Network, 
	network2: Network,
	...
}

Network = { 
	nickname: "YourNickname", 
	name: "Network Name", 
	chans: [Channel, Channel, Channel, ...]
}

Channel = { 
	users: [User, User, User, ...], 
	created: "UnixTime",
	key :"#channelname",
	mode : "+modes",
	topic : "Channel Topic", // May be missing if not set
	topicBy : "Username",    // May be missing if not set
}

User = {
	"Username" : "@",    // User Mode (symbol)
	"AnotherUser" : "%+" // May have multiple modes
}

buffers Object can be either true or false, it indicates if the following messages are from buffers (last X lines of channels and queries) or new messages.

join Sent on user join (or if the client joined a channel).

Object = {
	network: "networkid", // Network joined
	channel: "#channel",  // Channel joined
	nickname: "Nickname", // Who joined
	time: Date            // When it happened
}

part Sent on user part (or if the client left a channel).

Object = {
	network: "networkid", // Network
	channel: "#channel",  // Channel
	nickname: "Nickname", // Who left
	message: "something", // Part message, if provided
	time: Date            // When it happened
}

message Sent on user message.

Object = {
	network: "networkid", // Network
	channel: "#channel",  // Channel
	nickname: "Nickname", // Who said it
	message: "something", // Message
	time: Date            // When it happened
}

names Response from server "NAMES" command.

Object = {
	network: "networkid",     // Network
	channel: "#channel",      // Channel
	nicks: [User, User, ...], // Users in the channel
	time: Date                // When it happened
}

topic Sent when the topic gets changed.

Object = {
	network: "networkid",// Network
	channel: "#channel", // Channel
	nickname: "Nickname",// Who changed the topic
	topic: "something",  // New topic
	time: Date           // When it happened
}

quit Sent when someone quits IRC.

Object = {
	network: "networkid",                // Network
	channels: ["#chan1", "#chan2", ...], // Common channels
	nickname: "Nickname",                // Who left
	reason: "something",                 // Quit message
	time: Date                           // When it happened
}

kick Sent when someone gets kicked.

Object = {
	network: "networkid", // Network
	channel: "#channel",  // Channel
	nickname: "Nickname", // Who's got kicked
	by: "OtherNickname",  // Who kicked
	reason: "something",  // Kick Message
	time: Date            // When it happened
}

ping Sent when pinged (or ponged). PONG requests are automatically sent, there is no need to implement them.

Object = {
	network: "networkid",    // Network
	server: "irc.server.net" // Server who sent it
}

nick Sent on nick change.

Object = {
	network: "networkid",                // Network
	channels: ["#chan1", "#chan2", ...], // Common channels
	oldnick: "OldNickname",              // Original nickname
	newnick: "NewNickname",              // Changed nickname
	time: Date                           // When it happened
}

invite Sent when invited to a channel.

Object = {
	network: "networkid", // Network
	channel: "#channel",  // Channel
	from: "OldNickname",  // Who invited?
	time: Date            // When it happened
}

mode Sent whenever a mode is added or removed.

Object = {
	network: "networkid", // Network
	channel: "#channel",  // Channel
	by: "OldNickname",    // Who changed
	what: "+",            // Either "+" or "-"
	mode: "o",            // Mode set (single letter)
	args: "Nickname",     // Argument (ex. who has been opped)
	time: Date            // When it happened
}

whois Response of "WHOIS" command.

Object = {
	network: "networkid", // Network
	info: WhoisData,      // Data from Whois
	time: Date            // When it happened
}

WhoisData = {
	nick: "MyNick"            // Nickname
	realname: "My real name"  // Real Name
	user: "mynick"            // Identd (or User)
	host: "my.custom.vhost"   // Host
	channels: ["#chan1", ...],// Channels
	server: "irc.myserv.com"  // Server
	serverinfo: "BestServ!"   // Server info
	idle: 1634                // Idle time (in seconds)
}

ircerror Sent on IRC error (do not confuse with the error, which is a socket.io error)

Object = {
	network: "networkid", // Network
	message: "errormsg",  // Error data
}

list Response from "LIST" command

Object = {
	network: "networkid",                  // Network
	list: [ListChannel, ListChannel, ...]  // Channel list
}

ListChannel = {
	name: "#channel" // Channel name
	users: 20        // How many users it has
	topic: "MyTopic" // What's the topic
}

ctcp On received CTCP message

Object = {
	network: "networkid", // Network
	from: "Nickname",     // Who sent it
	to: "Othernick",      // To whom
	type: "VERSION",      // CTCP type
	text: "Blahblah",     // CTCP content
}


Powered by Node.js - Hosted on GitHub