QA InfoTech » Dot Net » Chat-js jQuery plugin for Facebook-style messaging

Chat-js jQuery plugin for Facebook-style messaging

 Introduction :

ChatJS is a full-featured, lightweight, Facebook style jQuery plugin for instant messaging. It also comes with a server side implementation for ASP.NET/SignalR out of the box. ChatJS is a chat component for ASP.NET. It uses SignalR for client/server communication and several jQuery plugins for UI.

 Description :

 ChatJS chat is implemented with two script files one is jQuery.chatjs.js plugin it depends completely on client side. In order to implement the interface between jquery.chatjs.js and the server, you need an adapter. The first one, jquery.chatjs.signalradapter.js, is meant to be used with ASP.NET and SignalR. This is the preferable way for working with ASP.NET. The second one is jquery.chatjs.longpollingadapter.js which is the generic client-side implementation. This adapter can work with whatever server-side implementation you use, like .Net PHP, Java or NodeJS, as long as the proper end-points are implemented.

By using chatjs plugin once we setup server side it’s very simple to write clientside code that will be like as shown below

 This jQuery plugin has got the following features :-

  • Real time message sharing.

  • Automatically parses URLs and emoticons.

  • Automatically remembers opened windows across diferent requests (through cookies).

  • Triggers a sound notification when the user receives a message.

  • Indicates when the other user is typing.

  • Supports multiple chat rooms. If you have a multi-tenancy app you can create a room for each tenancy, for instance.

  • Supports multiple browser windows opened with the same session. They all get properly sinchronized.

  • Customizable texts. You can easily translate it to your language.

  • Both client and server code ready to be used for ASP.NET with SignalR.

$.chat({

// your user information

user: {

Id: 3,

Name: 'Ranjan Jha',

ProfilePictureUrl: 'https://www.qainfotech.com/profile/123456'

},

// text displayed when the other user is typing

typingText: ' is typing...',

// the title for the user's list window

titleText: 'ChatJS demo chat',

// text displayed when there's no other users in the room

emptyRoomText: "There's no one around here.",

// the adapter you are using. There are 2 implementations out of the box:

// SignalRAdapter and LongPollingAdapter (server independent).

adapter: new SignalRAdapter()

});

The first thing to do is to determine which adapter you want to use. The adapter is the piece of code that will determine how the client will communicate to the server. ChatJS comes with two adapters and an ASP.NET sample that supports both. If you are working with ASP.NET, it’s highly recommended that you use SignalR. ASP.NET SignalR is a new library for ASP.NET developers that make it incredibly simple to add real-time web functionality to your applications.

If you want more details related this application check this link jQuery Chatjs Plugin.

About the Author