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

import com.bohuikeji.frame.module.admin.entity.back.APIEntity;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.handler.annotation.MessageMapping;
import org.springframework.messaging.handler.annotation.SendTo;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.socket.WebSocketHandler;

/**
 * 日志推送socket
 */
@Slf4j
@Controller
public class LogSocket {

    @Autowired
    private WebSocketHandler stompMsgTemplate;

    /**
     * 服务端推送
     * @param cid
     * @param message
     * @return
     */
    @MessageMapping("/log/push/msg")
    @SendTo("/socket/client/msg")
    public APIEntity pushToWeb(String message) {
        log.info("接收客户端消息：{}",message);
        return APIEntity.success("哈哈哈哈");
    }


}
