title: K8s Pod exec via sockJS, webSocket disconnects after I enter any character, what should I do?
body: <p>K8s Pod exec via sockJS, webSocket disconnects after I enter any character?
  I tried to use xtrem combined with sockjs to connect to kubernetes to execute the command, I got an error 1: &quot;Process exited&quot;, it was sent immediately after I entered the command</p>
  <pre><code>    const term = new Terminal({
        rendererType: 'canvas',
        cursorBlink: true,
        cursorStyle: &quot;underline&quot;,
        convertEol: true,
        allowTransparency: true,
        fontFamily: 'operator mono,SFMono-Regular,Consolas,Liberation Mono,Menlo,monospace',
        fontSize: 15,
        disableStdin: false,
        scrollback: 10000,
        tabStopWidth: 8,
        bellStyle: &quot;sound&quot;,
        rightClickSelectsWord: true,
        row: 42,
        cols: 188,
        rows: 42,
  
        theme: {
          foreground: &quot;white&quot;,
          background: &quot;#060101&quot;,
          cursor: &quot;help&quot;,
        }
      })
      const webLinksPlugin = new WebLinksAddon();
      const SearchPlugin = new SearchAddon();
      const fitAddon = new FitAddon();
      term.loadAddon(fitAddon)
      term.loadAddon(webLinksPlugin);
      term.loadAddon(SearchPlugin);
  
  
      const webssh = (sessionId) =&gt; {
        const ws = new SockJS(`http://localhost:88/api/v1/ws/podssh/podssh?${sessionId}`);
        const attachAddon = new AttachAddon(ws);
        term.loadAddon(attachAddon);
        term.open(document.getElementById('terminal'));
  
        ws.onopen = function (e) {
          term.writeln(&quot;connection...&quot;);
          setTimeout(() =&gt; ws.send(JSON.stringify({Op: 'bind', SessionID: sessionId})), 500)
        }
        term.onData(function (str) {
          ws.send(JSON.stringify({'Op': 'stdin', 'Data': str, SessionID: sessionId}));
          term.write(str)
        });
  
        ws.onmessage = function (e) {
          let msg = JSON.parse(e.data);
          switch (msg['Op']) {
            case 'stdout':
              console.log(&quot;stdout----&quot;, msg['Data'])
              term.write(msg['Data']);
              break;
            case 'toast':
              // message.info(msg['Data']);
              console.log(msg['Data'])
              break;
            default:
              term.writeln('Unexpected message type:', msg);
          }
  
        };
        ws.onclose = function (e) {
          console.log(&quot;web_console on close: &quot;, e)
        }
  
      }
  </code></pre>
  <p>I'm not sure where is the problem, please help me？
  <a href="https://i.stack.imgur.com/EnRzZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EnRzZ.png" alt="enter image description here" /></a></p>
  <pre><code>E0105 15:24:44.459965   20696 v2.go:105] invalid character 'w' looking for beginning of value
  </code></pre>