The connection.start() method throws that '...websocket is not in the Open state'.
So placing JavaScript code inside a <script> block within the <head> section or at the end of the <body> section of your HTML page is typically the recommended approach.
[
add
]
[
|
|
...
]