From 3870bdc8ee13bc7775527fb9b5f4acfd684d2b91 Mon Sep 17 00:00:00 2001 From: Comet Date: Thu, 26 Sep 2019 15:31:06 +0300 Subject: [PATCH] Update to fix changed api ? --- src/index.js | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/index.js b/src/index.js index 3a5c5dd..c6ed940 100644 --- a/src/index.js +++ b/src/index.js @@ -50,22 +50,21 @@ export function createWebsocketMiddleware (options = {}) { connections[endpoint] = connection - connection.onmessage(function (data) { + connection.socket.onmessage = function (data) { store.dispatch(createMessageAction(endpoint, data)) - }) + } - connection.onopen(function () { + connection.socket.onopen = function () { store.dispatch(createConnectionAction(endpoint)) - }) + } - connection.onclose(function () { + connection.socket.onclose = function () { store.dispatch(createDisonnectionAction(endpoint)) - }) + } - connection.onerror(function (error) { + connection.socket.onerror = function (error) { store.dispatch(createErrorAction(endpoint, error)) - }) - + } return connection }