added implementation for webSocket communication