package com.bohuikeji.frame.module.admin.controller.socket;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RestController;

import javax.websocket.OnClose;
import javax.websocket.OnMessage;
import javax.websocket.OnOpen;
import javax.websocket.Session;
import javax.websocket.server.ServerEndpoint;

/**
 * webSocket原生链接
 * @author 孙劲辉
 */
@ServerEndpoint(value = "/websocket/connect")
@RestController
@Slf4j
public class WebSocket {

    @OnOpen
    public void connect(Session session){
        //log.info(param);
        log.info("6666+{}",session);
    }
    @OnMessage
    public void receiveMsg(String msg, Session session) {
        log.info("收到消息：{}",msg);
    }
    @OnClose
    public void disConnect(Session session){
        log.info("关闭");
    }
}
