diff options
author | Victor Chabbert <chabbertvi@eisti.eu> | 2017-05-28 23:39:12 +0200 |
---|---|---|
committer | Victor Chabbert <chabbertvi@eisti.eu> | 2017-05-28 23:39:12 +0200 |
commit | bb2ced764938c4aa6b4e003b7dedb26c8a096b97 (patch) | |
tree | 7adf701e85f724b85fe042ef9ae00ff52e3c5213 /frontend/src/utils | |
parent | Upgrade react-scripts (diff) | |
download | seven-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.js | 5 |
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)); |