0
我有一個在Jboss上運行的@ServerEndpoint,它包含websocket連接。客戶不希望通過@ ServerEndpoint的@onMessage完成數據推送,而是向某個REST端點發送一個POST請求,然後將數據推送到websocket連接(是的,我也不知道它)。所以我的問題是;我可以從REST端點獲取websocket會話而無需打開服務器到服務器連接到@ServerEndpoint(導致用戶的安全上下文被破壞)?從REST服務訪問websocket @endpoint
所以我需要的東西是這樣的:
@Controller
@Path("/path")
public class WebsocketController {
@GET
public void doPost(String text) {
//somehow get all websocket connections to the @ServerEndpoint
//then for all sessions do:
session.getBasicRemote().sendText(text);
}
}
真的什麼任何合理的解決方案將放在@ServerEndpoint