refactoring story connection so that it is json over websockets