Websockets are a natively supported way for a server communicating with a player in Minecraft. The official Script API of Minecraft however is generally preferred over using a websocket connection.
This API is a wrapper for Minecraft Bedrock Edition's (and Minecraft Education Edition's) websocket capabilities. It allows you to send commands to the server and listen to events that happen in-game.