Maxwell Equations (Integral)
  1. Gauss’ Law:

$$ \iint_{\partial \Omega} \mathbf{E} \cdot d\mathbf{S} = 4 \pi \iiint_{\Omega} \rho dV $$

  1. Gauss’ Law for Magnetism: $$ \iint_{\partial \Omega} \mathbf{B} \cdot d\mathbf{S} = 0 $$

  2. Maxwell-Faraday Equation:

$$ \oint_{\partial \Omega} \mathbf{E} \cdot d\mathbf{l} = -\frac{d}{dt} \int_{\Sigma} \mathbf{B} \cdot d\mathbf{S} $$

  1. Ampère’s circuital law:

$$ \oint_{\partial \Omega} \mathbf{B} \cdot d\mathbf{l} = \mu_0 \left(\iint_{\Sigma} \mathbf{J} \cdot d\mathbf{S} + \epsilon_0 \frac{d}{dt} \iint_{\Sigma} \mathbf{E} \cdot d\mathbf{S}\right) $$

Maxwell Equations (Differential)
  1. Gauss’ Law:

$$ \nabla \cdot \mathbf{E} = \frac{\rho}{\epsilon_0} $$

  1. Gauss’ Law for Magnetism:

$$ \nabla \cdot \mathbf{B} = 0 $$

  1. Maxwell-Faraday Equation:

$$ \nabla \times \mathbf{E} = \frac{\partial \mathbf{B}}{\partial t} $$

  1. Ampère’s circuital law:

$$ \nabla \times \mathbf{B} = \mu_0 \left( \mathbf{J} + \epsilon_0 \frac{\partial \mathbf{E}}{\partial t} \right) $$

Connect to a Websocket

A sample python program is shown here.

import websocket


def on_message(ws, message):
    print(message)

def on_error(ws, error):
    print(f"Encountered error: {error}")
    
def on_close(ws, close_status_code, close_msg):
    print("Connection closed")

def on_open(ws):
    print("Connection opened")
    ws.send("Hello, Worldy!")

if __name__ == "__main__":
    ws = websocket.WebSocketApp("ws://localhost:xxxx", # insert here you websocket addres
                                on_message=on_message,
                                on_error=on_error,
                                on_close=on_close)
    ws.on_open = on_open
    ws.run_forever()

Run the program as below:

$ python websocket_example.py