spring-boot-websocket-netty-server, 依赖spring-boot-parent
Spring Boot: user notifications with web socket
This example will shows how to send notifications, via web socket, to specific logged-in users.
Could be useful, for example, if you are trying to implement a real-time user notification system.
Build and run
springboot启动后: http://localhost/
Configurations
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
<version>4.1.12.Final</version>
</dependency>
@SpringBootApplication
public class NettyWebSocketServerApplication implements CommandLineRunner{
@Autowired
private ChatServer chatServer;
public static void main(String[] args) {
SpringApplication.run(NettyWebSocketServerApplication.class, args);
}
@Bean
public ChatServer chatServer() {
return new ChatServer();
}
@Override
public void run(String... args) throws Exception {
InetSocketAddress address = new InetSocketAddress("127.0.0.1", 9090);
ChannelFuture future = chatServer.start(address);
Runtime.getRuntime().addShutdownHook(new Thread(){
@Override
public void run() {
chatServer.destroy();
}
});
future.channel().closeFuture().syncUninterruptibly();
}
}
Prerequisites
- Java 8
- Maven > 3.0
From terminal
Go on the project's root folder, then type:
$ mvn spring-boot:run
项目完整地址: spring-boot-netty
相关推荐
需求:服务端主动向客户端推送消息,服务端配置心跳,根据读写设置心跳时间,定时判断客户端是否有消息互动,客户端定时推送消息至服务端,如果时间段内未推送,则判断为网络断开或其他原因,服务端将长连接断开。
绍如何搭建一个准实时聊天问答程序,包括微信小程序和H5网页版。...该项目服务端主要使用了Java + Spring Boot + Netty + WebSocket等技术栈,聊天客户端使用的是UniApp来轻松搭建微信小程序和H5网页端。
前端:vue,服务端netty 踩坑指南 iOS版本手机QQ中清空不了Cookie的bug(Android版本的QQ没试),其他浏览器均正常 手机微信中打开后点击输入文字后,不管点不点击发送按钮都会出现短暂的不能点击的现象(任何按钮都...
前端:vue,服务端netty 踩坑指南 iOS版本手机QQ中清空不了Cookie的bug(Android版本的QQ没试),其他浏览器均正常 手机微信中打开后点击输入文字后,不管点不点击发送按钮都会出现短暂的不能点击的现象(任何按钮都...
iot物联网框架基于netty, spring boot, redis等开源项目开发来的物联网框架, 支持udp, tcp底层协议和http, mqtt, modbus等上层协议. 支持对设备同步和异步的调用操作. 主要向开发人员开放了一套统一、简洁的用于操作...
介绍:Springboot、netty实现的http-flv、websocket-flv流媒体服务(可用于直播点播),支持rtsp、h264、h265等、rtmp等多种源,h5纯js播放(不依赖flash),不需要依赖nginx等第三方,低延迟(支持识别h264、aac...
主要介绍了SpringBoot整合Netty心跳机制过程详解,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下
允许socket / websocket同时连接,兼容手游/页游服务端架构 有独立http后台网站,为游戏运维/运营提供支持 框架提供多种组件,可以直接二次开发业务逻辑 提供热更机制以及jmx接口,方便对生产项目进行监控与维护 ...
技术体系:Spring Boot、Vue、Netty、Websocket、xterm等。目录结构:agent-dist 存放打包的agent.jar(打包后出现)agent-proxy-dist 存放打包的proxy.jar(打包后出现)arthas-dist 用于支持arthas命令集config agent...