var wsId = Matrix.getObject("SocketId");
if (ws != undefined && ws.readyState !== WebSocket.CLOSED){
alert("WebSocket is already opened");
}
ws = new WebSocket("ws://aud7서버주소/push");
ws.onopen = function (event){
//alert("websocket [open] ");
ws.send("{\"serviceCode\":\""+reportCode+"\",\"data\":\"socket id 전달 요청\"}");
}
ws.onmessage = function (event){
alert("[message] -"+event.data);
var msg = JSON.parse(event.data);
//var socketId = msg.socketId ;
if (msg.socketId.length > 0)
socketId.Text = msg.socketId ;
//alert("[socketId] -"+socketId);
}
ws.onclose = function (event){
alert("[close] Websocket close");
}
function webSocketSendMessageApi() {
var api = "/api/ws/push/exec/send-message";
console.log(sendMsgText);
if (sendMsgText.Text.length > 0){
var searchParam = {
"serviceCode": "서비스코드",
"data": "발송메세지",
"socketId": wsId.Text
};
Matrix.CallRestAPI(api ,searchParam , null);
}
}