package com.yushu.web.controller.websocket;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.yushu.common.core.domain.AjaxResult;

/**
 * WebSocket测试控制器
 */
@RestController
@RequestMapping("/websocket")
public class WebSocketTestController {
    
    @GetMapping("/test")
    public AjaxResult test() {
        return AjaxResult.success("WebSocket服务正常运行");
    }
    
    @GetMapping("/info")
    public AjaxResult info() {
        return AjaxResult.success()
            .put("endpoint", "/ws/message")
            .put("testEndpoint", "/ws/test")
            .put("protocol", "ws://")
            .put("port", "8080")
            .put("status", "active")
            .put("timestamp", System.currentTimeMillis());
    }
    
    @GetMapping("/endpoints")
    public AjaxResult endpoints() {
        return AjaxResult.success()
            .put("endpoints", new String[]{"/ws/test", "/ws/message"})
            .put("note", "请重启服务器后测试连接");
    }
}
