package com.ym.mec.biz.service;

import com.ym.mec.biz.dal.dto.WebSocketInfo;
import org.springframework.web.socket.BinaryMessage;
import org.springframework.web.socket.TextMessage;
import org.springframework.web.socket.WebSocketSession;

/**
 * @Author Joburgess
 * @Date 2021/8/5 0005
 **/
public interface WebSocketEventHandler {

    /**
     * @describe 连接成功
     * @author Joburgess
     * @date 2021/8/5 0005
     * @param session: 会话信息
     * @return void
     */
    void afterConnectionEstablished(WebSocketSession session, String phone);

    /**
     * @describe 接受到文本信息
     * @author Joburgess
     * @date 2021/8/5 0005
     * @param session: 会话信息
     * @param message: 文本信息
     * @return void
     */
    void receiveTextMessage(WebSocketSession session, String phone, WebSocketInfo message);

    /**
     * @describe 接收到二进制数据
     * @author Joburgess
     * @date 2021/8/5 0005
     * @param session: 会话信息
     * @param message: 二进制数据
     * @return void
     */
    void receiveBinaryMessage(WebSocketSession session, String phone, BinaryMessage message);

    /**
     * @describe 连接关闭
     * @author Joburgess
     * @date 2021/8/5 0005
     * @param session: 会话信息
     * @return void
     */
    void afterConnectionClosed(WebSocketSession session, String phone);

}
