package com.usky.alarm.controller.api;

import com.alibaba.fastjson.JSONObject;
import com.usky.alarm.RemoteWebSocketService;
import com.usky.alarm.service.config.websocket.WebSocketPatrol;
import com.usky.common.core.bean.ApiResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;


@RestController
public class WebSocketControllerApi implements RemoteWebSocketService {

    @Autowired
    private WebSocketPatrol webSocketPatrol;
    @Override
    public ApiResult<Void> selfCheck(String requestBody) {
        JSONObject eventVO = JSONObject.parseObject(requestBody);
        webSocketPatrol.sendMessage(eventVO,eventVO.getString("deviceId"));
        return ApiResult.success();
    }
}
