Stomp user 소켓 연결 및 해제 감지공부방/Server2023. 10. 20. 01:22
Table of Contents
@Configuration
@EnableWebSocketMessageBroker
@PropertySource("classpath:application.properties")
class WebSocketConfig: WebSocketMessageBrokerConfigurer {
override fun configureWebSocketTransport(registration: WebSocketTransportRegistration) {
registration.addDecoratorFactory { handler ->
object : WebSocketHandlerDecorator(handler) {
@Throws(Exception::class)
override fun afterConnectionEstablished(session: WebSocketSession) {
// We will store current user's session into WebsocketSessionHolder after connection is established
val username = session.id
print("afterConnectionEstablished session ${username}")
super.afterConnectionEstablished(session)
}
override fun afterConnectionClosed(session: WebSocketSession, closeStatus: CloseStatus) {
super.afterConnectionClosed(session, closeStatus)
val username = session.id
print("afterConnectionClosed session ${username}")
}
}
}
}
}
반응형
'공부방 > Server' 카테고리의 다른 글
How to run docker in linux (0) | 2023.03.06 |
---|---|
How to install docker in aws linux free tier (AWS 리눅스 프리티어에 도커 설치 방법) (0) | 2023.03.06 |
How to assignment IPv6 in AWS ec2 (AWS ec2 IPv6 할당 방법) (0) | 2021.07.30 |
How to change linux java version (0) | 2020.07.25 |
Sequelize Query 정리 (0) | 2019.09.18 |
@soycrab :: 꿀맛코딩
행복한 코딩을 위하여!
포스팅이 좋았다면 "좋아요❤️" 또는 "구독👍🏻" 해주세요!