public class WebSocketServer extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
protected org.slf4j.Logger |
log |
| 构造器和说明 |
|---|
WebSocketServer() |
| 限定符和类型 | 方法和说明 |
|---|---|
static String |
channelKey(io.netty.channel.Channel channel) |
io.netty.channel.Channel |
getChannel(String key) |
int |
getSize() |
void |
join(io.netty.channel.Channel channel) |
void |
remove(io.netty.channel.Channel channel) |
void |
removeAll() |
io.netty.channel.group.ChannelGroupFuture |
sendAll(io.netty.handler.codec.http.websocketx.WebSocketFrame msg)
发送消息到所有客户端
|
io.netty.channel.ChannelFuture |
sendTo(String key,
io.netty.handler.codec.http.websocketx.WebSocketFrame msg)
指定客户端发送消息
|
void |
setAuthenticationHandler(AbstractWebSocketAuthenticationHandler authenticationHandler) |
void |
setCheckHeartbeat(boolean checkHeartbeat,
int pingOfSeconds,
int checkHeartbeatOfSeconds) |
void |
setClientEventPublisher(ClientEventPublisher clientEventPublisher) |
void |
setMaxContentLength(int maxContentLength) |
void |
setMaxFrameSize(int maxFrameSize) |
void |
setSslContext(SSLContext sslContext) |
void |
setSslContext(String type,
String path,
String password) |
io.netty.channel.ChannelFuture |
start(String websocketPath,
int port,
io.netty.channel.EventLoopGroup bossGroup,
io.netty.channel.EventLoopGroup workerGroup,
AbstractWebSocketServerHandler handler) |
io.netty.channel.ChannelFuture |
start(String websocketPath,
int port,
int workThread,
AbstractWebSocketServerHandler handler) |
io.netty.channel.ChannelFuture |
start(String websocketPath,
int port,
int bossThread,
int workThread,
AbstractWebSocketServerHandler handler) |
public io.netty.channel.ChannelFuture start(String websocketPath, int port, int workThread, AbstractWebSocketServerHandler handler) throws Exception
Exceptionpublic io.netty.channel.ChannelFuture start(String websocketPath, int port, int bossThread, int workThread, AbstractWebSocketServerHandler handler) throws Exception
Exceptionpublic io.netty.channel.ChannelFuture start(String websocketPath, int port, io.netty.channel.EventLoopGroup bossGroup, io.netty.channel.EventLoopGroup workerGroup, AbstractWebSocketServerHandler handler) throws Exception
Exceptionpublic void join(io.netty.channel.Channel channel)
public void remove(io.netty.channel.Channel channel)
public int getSize()
public io.netty.channel.Channel getChannel(String key)
public static String channelKey(io.netty.channel.Channel channel)
public void removeAll()
public io.netty.channel.ChannelFuture sendTo(String key, io.netty.handler.codec.http.websocketx.WebSocketFrame msg)
public io.netty.channel.group.ChannelGroupFuture sendAll(io.netty.handler.codec.http.websocketx.WebSocketFrame msg)
public void setClientEventPublisher(ClientEventPublisher clientEventPublisher)
public void setCheckHeartbeat(boolean checkHeartbeat,
int pingOfSeconds,
int checkHeartbeatOfSeconds)
public void setAuthenticationHandler(AbstractWebSocketAuthenticationHandler authenticationHandler)
public void setSslContext(SSLContext sslContext)
public void setSslContext(String type, String path, String password) throws Exception
Exceptionpublic void setMaxFrameSize(int maxFrameSize)
public void setMaxContentLength(int maxContentLength)
Copyright © 2022–2023. All rights reserved.