Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
leelance committed Jun 21, 2017
1 parent 08f21ce commit 7eee364
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions spring-boot-websocket-netty-server/README.md
Expand Up @@ -16,6 +16,13 @@ springboot启动后: http://localhost/
![image](https://github.com/leelance/spring-boot-all/blob/master/spring-boot-websocket-netty-server/3.png)
![image](https://github.com/leelance/spring-boot-all/blob/master/spring-boot-websocket-netty-server/4.png)
#### Configurations
```xml
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
<version>4.1.12.Final</version>
</dependency>
```
```java
@SpringBootApplication
public class NettyWebSocketServerApplication implements CommandLineRunner{
Expand All @@ -35,14 +42,14 @@ public class NettyWebSocketServerApplication implements CommandLineRunner{
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();
}
}
Expand Down

0 comments on commit 7eee364

Please sign in to comment.