public class ChildrenDeviceSession extends Object implements DeviceSession
| 构造器和说明 |
|---|
ChildrenDeviceSession(String deviceId,
DeviceSession parent,
DeviceOperator operator) |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
close()
关闭session
|
long |
connectTime() |
Optional<InetSocketAddress> |
getClientAddress() |
java.time.Duration |
getKeepAliveTimeout() |
DeviceOperator |
getParentDevice() |
Optional<String> |
getServerId() |
Transport |
getTransport()
传输协议,比如MQTT,TCP等
|
boolean |
isAlive() |
boolean |
isWrapFrom(Class<?> type)
判断会话是否包装自指定的类型,在某些场景下,可能会对会话进行包装
|
long |
lastPingTime() |
void |
onClose(Runnable call)
设置close回调
|
void |
ping()
心跳
|
reactor.core.publisher.Mono<Boolean> |
send(EncodedMessage encodedMessage)
发送消息给会话
|
void |
setKeepAliveTimeout(java.time.Duration timeout)
设置心跳超时时间
|
String |
toString() |
<T extends DeviceSession> |
unwrap(Class<T> type)
展开为指定对会话类型,通过此方法拿到最原始对会话对象进行操作.如果类型不一致可能会抛出
ClassCastException |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetDeviceId, getId, getOperator, keepAlivepublic ChildrenDeviceSession(String deviceId, DeviceSession parent, DeviceOperator operator)
public DeviceOperator getParentDevice()
public long lastPingTime()
lastPingTime 在接口中 DeviceSessionpublic long connectTime()
connectTime 在接口中 DeviceSessionpublic reactor.core.publisher.Mono<Boolean> send(EncodedMessage encodedMessage)
DeviceSessionsend 在接口中 DeviceSessionencodedMessage - 消息MqttMessagepublic Transport getTransport()
DeviceSessiongetTransport 在接口中 DeviceSessionpublic void close()
DeviceSessionclose 在接口中 DeviceSessionpublic void ping()
DeviceSessionping 在接口中 DeviceSessionDeviceSession.keepAlive()public boolean isAlive()
isAlive 在接口中 DeviceSessionpublic void onClose(Runnable call)
DeviceSessiononClose 在接口中 DeviceSessioncall - 回调public Optional<String> getServerId()
getServerId 在接口中 DeviceSessionpublic boolean isWrapFrom(Class<?> type)
DeviceSessionisWrapFrom 在接口中 DeviceSessiontype - 类型public Optional<InetSocketAddress> getClientAddress()
getClientAddress 在接口中 DeviceSessionpublic void setKeepAliveTimeout(java.time.Duration timeout)
DeviceSessionsetKeepAliveTimeout 在接口中 DeviceSessiontimeout - 心跳超时时间public java.time.Duration getKeepAliveTimeout()
getKeepAliveTimeout 在接口中 DeviceSessionpublic <T extends DeviceSession> T unwrap(Class<T> type)
DeviceSessionClassCastExceptionunwrap 在接口中 DeviceSessionT - 类型泛型type - 类型Copyright © 2019–2022. All rights reserved.