https://github.com/kocyigitkim/realtime.io
Real time data streaming & socket programming library
https://github.com/kocyigitkim/realtime.io
data realtime socket streaming
Last synced: 11 months ago
JSON representation
Real time data streaming & socket programming library
- Host: GitHub
- URL: https://github.com/kocyigitkim/realtime.io
- Owner: kocyigitkim
- License: mit
- Created: 2021-01-17T16:51:23.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2021-11-12T05:32:26.000Z (over 4 years ago)
- Last Synced: 2025-06-28T08:16:02.353Z (12 months ago)
- Topics: data, realtime, socket, streaming
- Language: JavaScript
- Homepage:
- Size: 55.7 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Introduction
Real time data streaming & socket programming library
# Getting Started
Steps:
1. Installation
2. Software dependencies
3. Usage
# 1. Installation
- npm install realtime.io
- yarn add 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_
```js
// Import RealTime.IO Library
const realtimeio = require('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_
```js
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 ?
```js
// 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 ?
```js
// Import RealTime.IO Library
const realtimeio = require('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?
```js
class NotificationClientObject extends realtimeio.client.RealtimeIOClientObject{
constructor(client){
super('notification', client);
}
showNotification(type, title, message){}
}
```
##### F. How To Send A New Notification ?
```js
// Connect to server
client.connect();
// Send new notification
const notificationObject = new NotificationClientObject(client);
notificationObject.showNotification('info', 'Example #1', 'Hello world :)');
```