This library was developed by https://www.pikchat.co. Pik Chat, an instant messaging solution (SDK, API and App) for your business website and application to engage your users effectively and efficiently to scale the impact.
This project uses node and npm. Go check them out if you don't have them locally installed.
npm install pikchat-sdk
const pikchat = require('pikchat');
const express = require('express');
const app = express();
const http = require('http');
const server = http.createServer(app);
pikchat.setConfig(pikchat.CONSTANTS.MYSQL_HOST, 'localhost');
pikchat.setConfig(pikchat.CONSTANTS.MYSQL_USERNAME, 'root');
pikchat.setConfig(pikchat.CONSTANTS.MYSQL_PASSWORD, 'root');
pikchat.setConfig(pikchat.CONSTANTS.MYSQL_DATABASE, 'chat');
pikchat.connectMySQL();
pikchat.startPikchatEngine(server);
server.listen(3000, () => {
console.log('listening on *:3000');
});
S.No | Event name | Description | Action |
---|---|---|---|
1. | SINGLE_CHAT_MESSAGE | view | |
2. | SINGLE_CHAT_MESSAGE_DELIVERED | view |
Event name : SINGLE_CHAT_MESSAGE
Params :
{
"senderId" : "1234",
"receiverId" : "1235",
"message" : "hi siva",
"messageType" : 1
}
Key | Value | Sample value | Description |
---|---|---|---|
senderId | String | 1234 | logged in user's id |
receiverId | String | 1235 | receiver user's id |
message | String | Hii siva | message |
messageType | Number | 1 | 1 - text message 2 - image |