search
Homephp教程PHP开发JavaScript/jQuery, HTML, CSS to build Web IM remote instant chat communication program

This article mainly introduces how to build a BS Web chat application using JavaScript, jQuery, HTML, CSS, and the third-party chat JavaScript (jsjac) framework. This program can communicate and send messages to all applications connected to the Openfire server. If you want to run this program, you also need a chat server Openfire,

and a third-party library (JabberHTTPBind) that needs to use Http to communicate with Openfire.

JabberHTTPBind is the Http bind sending form of XMPP protocol communication provided by jabber. It can complete the establishment of long connection communication between WebBrowser and Openfire.

The main communication process is shown in the figure below:

JavaScript/jQuery, HTML, CSS to build Web IM remote instant chat communication program

User A sends a message to the Servlet container of JabberHTTPBind through the JavaScript jsjac.js library, and then the Servlet container of JabberHTTPBind will send an XML message of the XMPP protocol to Openfire. Openfire Server parses the message after receiving it, and then sends it to the specified user B. After JabberHTTPBind obtains the data sent by Openfire Server, it parses the message to find the specified user in the linked Session in the current Servlet container and then sends the data to user B.

The WebBrowser side uses the connection established by jsjac and JabberHTTPBind. All data must be parsed/converted by JabberHTTPBind and sent to Openfire.

First take a picture to see the effect, haha~ Here is the chat screen of users hoojo and girl. The two parties are chatting with each other...

JavaScript/jQuery, HTML, CSS to build Web IM remote instant chat communication program

You can send emoticons and change font styles (you can also see the other party's interface) Your font style), and the right side is the information to display/shrink details

JavaScript/jQuery, HTML, CSS to build Web IM remote instant chat communication program

Shrink details

JavaScript/jQuery, HTML, CSS to build Web IM remote instant chat communication program

Partial screenshot of the chat interface

User login and registration, sendTo indicates who you will send chat messages to after logging in, And create a chat window

JavaScript/jQuery, HTML, CSS to build Web IM remote instant chat communication program

After successful login, you can see your login status in the log console, or see your connection request status in the firebug console

JavaScript/jQuery, HTML, CSS to build Web IM remote instant chat communication program

Failed login

JavaScript/jQuery, HTML, CSS to build Web IM remote instant chat communication program

Only connecting, nothing more

JavaScript/jQuery, HTML, CSS to build Web IM remote instant chat communication program

After successfully logging in, you can send messages to the specified user, and set the new user you want to send messages to. Click the new Chat button to create a new conversation

JavaScript/jQuery, HTML, CSS to build Web IM remote instant chat communication program

If you When a new message comes, there will be a new message prompt in the title bar of the browser

JavaScript/jQuery, HTML, CSS to build Web IM remote instant chat communication program

If the windows of your current chat interface are closed, there will be a flashing message prompt icon in the lower right corner

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Tools

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool