1.0.0 • Published 3 years ago

@mkocyigit01/realtime.io v1.0.0

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

Introduction

Real time data streaming & socket programming library

Getting Started

Steps: 1. Installation 2. Software dependencies 3. Usage

1. Installation

  • npm install @mkocyigit01/realtime-io
  • yarn add @mkocyigit01/realtime-io

2. Software dependencies

  • socket.io
  • socket.io-client
  • uuid
  • chalk
  • crypto
  • express
  • http
  • node-cache

    3. Usage

-- A. How To Create & Listen Server

// Import RealTime.IO Library
const realtimeio = require('@mkocyigit01/realtime-io');
// Define Server Options
// You can inspect server options from library
const serverOptions = new realtimeio.server.RealtimeIOServerOptions();
// Create RealTime Server
const server = new realtimeio.server.RealtimeIOServer(serverOptions);
// Listen
server.listen();

-- B. How To Define Server Object

class NotificationServerObject extends realtimeio.server.RealtimeIOServerObject{
    constructor(server){
	    super('notification', server);
    }
    Listener_showNotification(client, type, title, message){
	    console.log(['Type: ', type, 'Title: ', title, 'Message: ', message].join(' '));
    }
}

-- C. How To Use Notification Server Object ?

// Listen
server.listen();
// Write this code after listen server expression
const notificationServer = new NotificationServerObject(server);

Then everything will be nice :)

-- D. How To Create Client ?

// Import RealTime.IO Library
const realtimeio = require('@mkocyigit01/realtime-io');
// Define Client Options
// You can inspect client options from library
const clientOptions = new realtimeio.server.RealtimeIOClientOptions();
// Create RealTime Client
const client = new realtimeio.client.RealtimeIOClient(clientOptions);
// Connect to server
client.connect();

-- E. How To Define Client Object?

class NotificationClientObject extends realtimeio.client.RealtimeIOClientObject{
	constructor(client){
		super('notification', client);
	}
	showNotification(type, title, message){}
}

-- F. How To Send A New Notification ?

// Connect to server
client.connect();
// Send new notification
const notificationObject = new NotificationClientObject(client);
notificationObject.showNotification('info', 'Example #1', 'Hello world :)');

If you want to contact with me please follow these links

1.0.2

3 years ago

1.0.3

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago