summaryrefslogtreecommitdiff
path: root/frontend/src/utils
diff options
context:
space:
mode:
authorVictor Chabbert <chabbertvi@eisti.eu>2017-05-28 23:39:12 +0200
committerVictor Chabbert <chabbertvi@eisti.eu>2017-05-28 23:39:12 +0200
commitbb2ced764938c4aa6b4e003b7dedb26c8a096b97 (patch)
tree7adf701e85f724b85fe042ef9ae00ff52e3c5213 /frontend/src/utils
parentUpgrade react-scripts (diff)
downloadseven-wonders-bb2ced764938c4aa6b4e003b7dedb26c8a096b97.tar.gz
seven-wonders-bb2ced764938c4aa6b4e003b7dedb26c8a096b97.tar.bz2
seven-wonders-bb2ced764938c4aa6b4e003b7dedb26c8a096b97.zip
Initial type checking work with flowtype
Diffstat (limited to 'frontend/src/utils')
-rw-r--r--frontend/src/utils/websocket.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/frontend/src/utils/websocket.js b/frontend/src/utils/websocket.js
index b33b2d50..2751b16c 100644
--- a/frontend/src/utils/websocket.js
+++ b/frontend/src/utils/websocket.js
@@ -1,10 +1,11 @@
+// @flow
import SockJS from 'sockjs-client';
import Stomp from 'webstomp-client';
import { eventChannel } from 'redux-saga';
const wsURL = '/seven-wonders-websocket';
-export const createWsConnection = (headers = {}) =>
+export const createWsConnection = (headers: Object = {}) =>
new Promise((resolve, reject) => {
let socket = Stomp.over(new SockJS(wsURL), {
debug: process.env.NODE_ENV !== 'production',
@@ -12,7 +13,7 @@ export const createWsConnection = (headers = {}) =>
socket.connect(headers, frame => resolve({ frame, socket }), reject);
});
-export const createSubscriptionChannel = (socket, path) => {
+export const createSubscriptionChannel = (socket: any, path: string) => {
return eventChannel(emitter => {
const socketSubscription = socket.subscribe(path, event => {
emitter(JSON.parse(event.body));
bgstack15