summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoffrey BION <joffrey.bion@gmail.com>2017-05-21 19:43:25 +0200
committerJoffrey BION <joffrey.bion@gmail.com>2017-05-21 19:43:25 +0200
commitcc200f6c06f7dca838c497e47b5f85a91906387b (patch)
tree330e599a01632ef5d6de5ee38dec914a1d91c202
parentFix code style (diff)
downloadseven-wonders-cc200f6c06f7dca838c497e47b5f85a91906387b.tar.gz
seven-wonders-cc200f6c06f7dca838c497e47b5f85a91906387b.tar.bz2
seven-wonders-cc200f6c06f7dca838c497e47b5f85a91906387b.zip
Clean name in websocket.js
-rw-r--r--frontend/src/utils/websocket.js12
1 files changed, 3 insertions, 9 deletions
diff --git a/frontend/src/utils/websocket.js b/frontend/src/utils/websocket.js
index 6db91899..4a07d532 100644
--- a/frontend/src/utils/websocket.js
+++ b/frontend/src/utils/websocket.js
@@ -9,20 +9,14 @@ export const createWsConnection = (headers = {}) =>
let socket = Stomp.over(new SockJS(wsURL), {
debug: process.env.NODE_ENV !== "production"
});
- socket.connect(
- headers,
- frame => {
- return resolve({ frame, socket });
- },
- reject
- );
+ socket.connect(headers, frame => resolve({ frame, socket }), reject);
});
export const createSubscriptionChannel = (socket, path) => {
return eventChannel(emitter => {
- const receiveUsernameHandler = socket.subscribe(path, event => {
+ const socketSubscription = socket.subscribe(path, event => {
emitter(JSON.parse(event.body));
});
- return () => receiveUsernameHandler.unsubscribe();
+ return () => socketSubscription.unsubscribe();
});
};
bgstack15