提交 | 用户 | 时间
|
0ca254
|
1 |
package com.jcdm.framework.websocket; |
A |
2 |
|
|
3 |
import com.jcdm.common.core.domain.AjaxResult; |
|
4 |
import com.jcdm.common.core.page.TableDataInfo; |
|
5 |
import org.springframework.beans.factory.annotation.Autowired; |
|
6 |
import org.springframework.security.access.prepost.PreAuthorize; |
|
7 |
import org.springframework.web.bind.annotation.GetMapping; |
|
8 |
import org.springframework.web.bind.annotation.RestController; |
|
9 |
|
|
10 |
import javax.websocket.Session; |
|
11 |
import javax.websocket.server.PathParam; |
|
12 |
import java.util.List; |
|
13 |
import java.util.Map; |
|
14 |
|
|
15 |
@RestController("/socketController") |
|
16 |
public class PostController { |
|
17 |
|
|
18 |
@GetMapping("/postWebsocket") |
|
19 |
public AjaxResult list(@PathParam("locationCode") String locationCode) |
|
20 |
{ |
|
21 |
Map<String, Session> map = WebSocketUsers.getUsers(); |
|
22 |
//1、监听kepserver地址 比如:OP.OP1010.START 、OP.OP1020.START 、OP.OP1030.START |
|
23 |
//2、当其中一个点位发生变化时,判断该点位是哪一个工位 |
|
24 |
// |
|
25 |
WebSocketUsers.sendMessageToUserByText(map.get(locationCode), "1"); |
|
26 |
|
|
27 |
return AjaxResult.success(); |
|
28 |
} |
|
29 |
|
|
30 |
|
|
31 |
} |