2.0.7 • Published 5 years ago

rs-chat v2.0.7

Weekly downloads
5
License
MIT
Repository
github
Last release
5 years ago

Live Demo

https://rs-chat-demo.herokuapp.com

Demo Gif Image

Demo Gif

Youtube Instalation Guide

Youtube Instalation Guide

Getting started

Get a copy of the plugin

You can install it through npm.

$ npm install rs-chat

Setup for nodejs

Open index.js file and put the below code and start nodejs server

var app = require('http')
var chat = require('rs-chat')(app);

chat.init({
  host     : 'localhost', // DB host
  user     : 'user', // DB User
  password : 'password', // DB Password
  database : 'database', // DB Name
  assets   : 'assets' // assets path
});

Create table

CREATE TABLE `messages` (
  `id` int(11) NOT NULL,
  `userId` int(11) NOT NULL,
  `toId` int(11) NOT NULL,
  `msg` mediumtext COLLATE utf8mb4_bin NOT NULL,
  `type` int(1) UNSIGNED NOT NULL DEFAULT '0' COMMENT '0 / null = text, 1 = image, 2=video',
  `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `read_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;

Load the required files

Inside the page's head tag include the CSS file.

<link rel="stylesheet" type="text/css" href="https://unpkg.com/rs-chat@2.0.7/dist/rs-chat.min.css">

In the page's footer, just before </body>, include the required JavaScript files.

<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.2.0/socket.io.js"></script>

<script type="text/javascript" src="https://unpkg.com/rs-chat@2.0.7/dist/rs-chat.min.js"></script>

Instantiate the chat plugin

<script type="text/javascript">
  RSChat.init({
    socketUrl: 'http://localhost:8080/' // server url,
    userId: '1', // logged in user id
    name: 'ravi shukla', // logged in user name
  });
</script>

Call the below function to open chat box

RSChat.start('user_id', 'username')

Global Settings

S.NoOptionsTypePurpuse
1emoji(optional)BoolEnable emoji feature or not
3iconSize(optional)IntegerEmoji size
2media(optional)BoolEnable / Disable media
4assetPathStringAsset path for the media
6supportedFile(optional)ArraySupported media file
5invalidFileMessage(optional)StringMessage on wrong media file
7perPage(optional)IntegerPagination for the chat list
8marginRight(optional)IntegerMargin for each chat window
9beforeDialogOpen(optional)PromiseCallback before chat box open
10maxFileSize(optional)IntegerMax file size to upload default 1MB
11maxFileSizeError(optional)StringError message on big media file

Support

If you found a bug please submit it in the Issues.

If you need help with implementing the chat in your project, You can mail me at ravishkl5@gmail.com

Suggestion

If you have any suggestion, You can write mail to me at ravishkl5@gmail.com

2.0.7

5 years ago

2.0.6

5 years ago

2.0.5

5 years ago

2.0.4

5 years ago

2.0.3

5 years ago

2.0.2

5 years ago

2.0.1

5 years ago

1.0.7

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago