首页 > 解决方案 > How capture messages of WS/Socket url from network with JS?

问题描述

I want capture message of bellow image with javascript or jquery

https://i.stack.imgur.com/D6pHD.png

enter image description here

How can I?

This code not work for me:

var wsUri = "wss://****";
var output;

function init()
{
  output = document.getElementById("output");
  testWebSocket();
}

function testWebSocket()
{
  websocket = new WebSocket(wsUri);
  websocket.onopen = function(evt) { onOpen(evt) };
  websocket.onclose = function(evt) { onClose(evt) };
  websocket.onmessage = function(evt) { onMessage(evt) };
  websocket.onerror = function(evt) { onError(evt) };
}

标签: javascriptjquerysocketsws

解决方案


推荐阅读