Websockets always connect to a central server.
This allows to implement most of the game mechanics and store most of the gamestate on the server. The server only sends that information to the clients which they are supposed to show to the player and interprets any input from the client as a request which needs to be checked for validity and may be denied.
Libraries which implement the Websocket protocol exist for many programming languages. When there is no such library for your preferred language but it supports raw TCP sockets, you can always create your own implementation from the specification (It's not the most easy to implement protocol, though).