Express+Socket.IO 搭建即时聊天

Stella981
• 阅读 505

  技术栈是:nodejs express socketio bootstrap sqlite

  由于初学,代码排版模块化实现的不好,只是提供了一个功能。

 源码地址: https://github.com/Qquanwei/Wire  

 运行node server.js后即提供了一个端口号为8080的服务

初始打开的时候显示如下

 Express+Socket.IO 搭建即时聊天

 创建一个会话ID,如果该ID没有人创建过的话则直接创建成功,然后跳转到聊天界面。当然也可以通过连接按钮连接到已经创建好的聊天室中。

 聊天界面如下

   Express+Socket.IO 搭建即时聊天

 一个普通的聊天界面。 

    不安全因素就是在你聊天的时候可能被其他人乱入,因为没有提供验证机制,所以可以通过创建一些奇妙的会话ID来减少这种情况发生的可能性。 当然可以用中文,只要你把ID提供给你的朋友们,你们就可以一起happy的聊天了。

点赞
收藏
评论区
推荐文章
Easter79 Easter79
2年前
Thingsboard Gateway开发环境
源码下载地址:https://github.com/thingsboard/thingsboardgateway(https://www.oschina.net/action/GoToLink?urlhttps%3A%2F%2Fgithub.com%2Fthingsboard%2Fthingsboardgateway)国内大神源码地址:htt
Stella981 Stella981
2年前
PHP 实现简单的 Socks5 Server
利用Phalcon7的异步功能实现,完整源码https://github.com/dreamsxin/cphalcon7/blob/master/examples/async/Socks5Server.php。(https://www.oschina.net/action/GoToLink?urlhttps%3A%2F%2Fgithub.com%
Stella981 Stella981
2年前
Flutter环境搭建
本文介绍mac上搭建Flutter环境1、Flutter官方提供中国地区镜像地址:https://github.com/flutter/flutter/wiki/UsingFlutterinChina(https://www.oschina.net/action/GoToLink?urlhttps%3A%2F%2Fgithub.com%2Ff
Stella981 Stella981
2年前
Golang注册Eureka的工具包goeureka发布
1.简介提供Go微服务客户端注册到Eureka中心。点击:github地址(https://www.oschina.net/action/GoToLink?urlhttps%3A%2F%2Fgithub.com%2FSimonWang00%2Fgoeureka),欢迎各位多多star!(已通过测试验证,用于正式生产部署)2.原理
Stella981 Stella981
2年前
Mybatis 通用Crud
前言(说明)源码地址:https://github.com/LittleNewbie/portal(https://www.oschina.net/action/GoToLink?urlhttps%3A%2F%2Fgithub.com%2FLittleNewbie%2Fportal)mybatis版本 3.2.6mybatis
Stella981 Stella981
2年前
Spring Cloud Eureka 你还在让它裸奔吗??
前些天栈长在微信公众号Java技术栈分享了SpringCloudEureka最新版实现注册中心的实战教程:SpringCloudEureka注册中心集群搭建,Greenwich最新版!(https://www.oschina.net/action/GoToLink?urlhttps%3A%2F%2Fmp.weixin.qq.com%2
Stella981 Stella981
2年前
Spring Boot 2.1.6 发布了!
!(https://oscimg.oschina.net/oscnet/e5aaab7a5b9f4aa7a944b00aff253ed2.jpg)Java技术栈www.javastack.cn优秀的Java技术公众号(https://www.oschina.net/action/GoToLink?urlhttps%3
Stella981 Stella981
2年前
Google地球出现“无法连接到登录服务器(错误代码:c00a0194)”解决方法
Google地球出现“无法连接到登录服务器(错误代码:c00a0194)”解决方法参考文章:(1)Google地球出现“无法连接到登录服务器(错误代码:c00a0194)”解决方法(https://www.oschina.net/action/GoToLink?urlhttps%3A%2F%2Fwww.codeprj.com%2Fblo
Wesley13 Wesley13
2年前
94行代码实现网站多主题模板自由切换效果
源码下载地址:https://github.com/huangyouzhi/themechange(https://www.oschina.net/action/GoToLink?urlhttps%3A%2F%2Fgithub.com%2Fhuangyouzhi%2Fthemechange)94行代码网站多模板主题切换,适合多风
Stella981 Stella981
2年前
C++ spdlog日志管理
【1】spdlog简介spdlog是一个开源的、快速的、仅有头文件的基于C11实现的一款C专用日志管理库。【2】源码下载下载地址:https://github.com/gabime/spdlog(https://www.oschina.net/action/GoToLink?urlhttps%3A%2F%2Fgithub.com%2