Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebSocket test #881

Closed
7 tasks done
krizhanovsky opened this issue Jan 8, 2018 · 1 comment
Closed
7 tasks done

WebSocket test #881

krizhanovsky opened this issue Jan 8, 2018 · 1 comment
Assignees
Milestone

Comments

@krizhanovsky
Copy link
Contributor

krizhanovsky commented Jan 8, 2018

Need to develop a functional test for Tempesta FW websockets (#755). Python websockets can be used for both the client and server sides. However, it seems all Python websockets libraries (also websocket-client) depend on Python 3, so the issue is blocked by migration of our testing framework to Python3.

Following tests for HTTP/1 and HTTP/2 client must be done (UPD it seems the modern HTTP/2 applications prefer SSE over WebSockets, so it's hard to find an HTTP/2 WebSocket client):

  • ping pong over ws:// (for HTTP/1 only)
  • ping pong over wss:// (client - tfw - backend)
  • ping pong over wss:// (client - tfw - proxy - backend, see at the below)
  • HTTP tables rules to load balance websockets traffic by Host or Connection: upgrade headers We have other HTTPtable tests and it seems there is nothing special about websockets
  • cache: check that we never cache 101 responses with Upgrade header. Error responses for invalid client upgrade requests still can be cached
  • (stress test) establish many wss connections against several server groups using all current connections schedulers, cause severe load and do several Tempesta restarts during the workload
  • (scheduler stress test) we have stress tests for the schedulers, at least https://github.com/tempesta-tech/tempesta-test/blob/master/sched/test_hash_stress.py , so we need a similar tests for this and other schedulers to make sure that we can normally create a websocket under high scheduler load The test case seems covered by the previous test.

wss://

Tempesta FW doesn't have client side TLS (#769 ) yet. However, websockets have nothing about TLS and just use the same upgrade scheme for both ws:// and wss:// . In the default scheme a client connects Tempesta on HTTPS and Tempesta has plain HTTP connection to the backend, which leads to wss:// between the client and Tempesta and ws:// between Tempesta and the backend server.

One wishing to have wss:// to the backend should use an additional HTTPS server, e.g. Nginx or HAproxy, supporting client side TLS. Tempesta FW config must specify the server (typically running on the same host with Tempesta FW) as the backend server.

                       +---------------------------+
+--------+   wss://    |              ws://        |  wss://   +----------------+
| client | ----------> | Tempesta FW  -----> proxy | --------> | origin backend |
+--------+             |                           |           +----------------+
                       |     [one physical host]   |
                       +---------------------------+
@krizhanovsky krizhanovsky modified the milestones: 1.0 WebOS, backlog, 0.7 HTTP/2 Jan 8, 2018
@krizhanovsky krizhanovsky modified the milestones: 0.7 HTTP/2, 0.8 TDB v0.2 Mar 23, 2018
@krizhanovsky krizhanovsky modified the milestones: 1.2 TDB v0.2, 1.1 QUIC Aug 8, 2018
@krizhanovsky krizhanovsky modified the milestones: 1.1 QUIC, 1.0 Beta Feb 2, 2019
@krizhanovsky krizhanovsky modified the milestones: 0.9 - TDB, 1.2 TBD Jan 3, 2022
@krizhanovsky krizhanovsky mentioned this issue Feb 20, 2022
@krizhanovsky krizhanovsky changed the title Node.js WebSocket test WebSocket test Feb 21, 2022
@krizhanovsky krizhanovsky assigned pale-emperor and unassigned ttaym Feb 24, 2022
@pale-emperor pale-emperor pinned this issue Mar 11, 2022
@pale-emperor pale-emperor unpinned this issue Mar 11, 2022
@ttaym
Copy link
Contributor

ttaym commented Apr 20, 2022

It seams that there are not so many http/2 websocket clients. Only modern browsers are prominent wide-spread clients. For example:

<!DOCTYPE HTML>

<html>
   <head>
      <script type = "text/javascript">
         function WebSocketOpen() {
            if ("WebSocket" in window) {
               var ws = new WebSocket("wss://tempesta.test/url");
               ws.onopen = function() {
                  console.log('ws opened')
               };

               ws.onmessage = function (evt) {
                  var received_msg = evt.data;
                  console.log('ws msg: ' + received_msg)
               };

               ws.onclose = function() {
                  console.log('ws close')
               };

               window.ws = ws
            } else {
               alert("WebSocket NOT supported by your Browser!");
            }
         }
         function WebSocketSend() {
            window.ws.send("msg");
         }
         function WebSocketClose() {
            window.ws.close();
         }
      </script>
   </head>

   <body>
      <div id = "sse">
         <a href = "javascript:WebSocketOpen()">Open WebSocket</a>
         <a href = "javascript:WebSocketSend()">Send message to WebSocket</a>
         <a href = "javascript:WebSocketClose()">Close WebSocket</a>
      </div>
   </body>
</html>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants