Home > php教程 > php手册 > Workerman+layerIM+ThinkPHP5 webIM, instant messaging system

Workerman+layerIM+ThinkPHP5 webIM, instant messaging system

WBOY
Release: 2016-08-31 08:41:12
Original
7478 people have browsed it

A beautiful Workerman+layerIM+ThinkPHP5 webIM instant messaging system.

I have been reading about websocket in the past two days, and in addition to the previous article, I integrated a third-party webIM system, which is just a calling interface, but it is not a thing. Someone replied that your version is useless at all. If you integrate it into a Workerman, it will be almost the same. Well, workerman is just workerman. I have heard about Workerman for a long time, but I have never used it. I took this opportunity to see what it is like. Of course, I first looked at websocket communication and wrote an article. Of course, my writing was not very good, but the two articles I quoted were good. http://www.cnblogs.com/nickbai/articles/5816689.html If you want to know more about websocket, you can take a look.

Okay, now let’s get down to business.
First of all, let’s give a rough introduction to Workerman. I am using GatewayWorker this time. What the hell is this? Please see the official explanation of wokerman:
GatewayWorker is a set of TCP long-connection application framework developed based on Workerman. It implements interfaces such as single transmission, group transmission, and broadcast. It has a built-in mysql class library. GatewayWorker is divided into Gateway process and Worker process. It naturally supports distributed deployment and can support huge The number of connections (millions or even tens of millions of connection-level applications). It can be used to develop IM chat applications, mobile communications, game backends, Internet of Things, smart home backends, etc.

It’s something very 6, isn’t it!

Let me introduce layerIM again. I believe many people have used layer. Who knows who uses it? It is beautiful and powerful. The author Xianxin used to work at Alibaba, but now he is unemployed and focusing on layerUI at home. Why do you say this? I thought the layerIM I used this time was also made by Xianxin. I emphasize this because layerIM is not open source! So you can’t run my project locally if you get it. If a good open source project wants to run, it requires everyone's joint efforts. Here I will act as an advertisement for Xianxin, http://layim.layui.com/ If you want to use layerIM, go to the previous address for details. . My directory structure is as follows, you can put it like this after getting the authorization:
Workerman+layerIM+ThinkPHP5 webIM, instant messaging system

Let me talk about the progress of my project. Currently, only one-to-one chat has been implemented. The overall architecture has been integrated. After that, I will fill in the blanks according to the manual according to the needs. I believe that if you are smart, you will definitely complete it. This example is based on the Windows platform. I may talk about all the function completion later (depending on your mood, haha).

Let me show you the effect:
Workerman+layerIM+ThinkPHP5 webIM, instant messaging system
Workerman+layerIM+ThinkPHP5 webIM, instant messaging system

Here comes the point, let’s talk about how to configure the project:
1. Go to my github to download the integrated demo v1.0 version
https://github.com/nick-bai/laychat, of course you said, this is too rubbish, you can download Workerman yourself and do it yourself.
2. Configure your project and bind the virtual domain name to ensure access.
3. In start_for_win.bat under vendorWorkerman, you can see the following page:
Workerman+layerIM+ThinkPHP5 webIM, instant messaging system
Indicates that your Workerman has been started successfully! Here I did not use workererman to establish the HTTP server.
4. The most critical step (this one costs ¥ 100) is to support the open source project. Obtain the authorization file of layerIM and put it in the static folder. You can refer to the directory I gave.
5. Visit your tp project, log in,
Workerman+layerIM+ThinkPHP5 webIM, instant messaging system
Currently, only these three accounts can be logged in. Remember: I identify the login status based on session. Please open two browsers to simulate chatting with two accounts, otherwise it will not work.
Testing Jack Ma’s message to the paper airplane:
Workerman+layerIM+ThinkPHP5 webIM, instant messaging system
Workerman+layerIM+ThinkPHP5 webIM, instant messaging system

My github project address: https://github.com/nick-bai/laychat If you think it is useful to you, don’t be stingy with your little star.

source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template