Abstracted logic from web socket server