Skip to content

Commit

Permalink
Fix WebSocketProvider responses when message result is null (#813).
Browse files Browse the repository at this point in the history
  • Loading branch information
ricmoo committed May 3, 2020
1 parent 0d71cfb commit 472e5b0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/providers/src.ts/websocket-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,12 @@ export class WebSocketProvider extends JsonRpcProvider {
this._websocket.onmessage = (messageEvent: { data: string }) => {
const data = messageEvent.data;
const result = JSON.parse(data);
if (result.id) {
if (result.id != null) {
const id = String(result.id);
const request = this._requests[id];
delete this._requests[id];

if (result.result) {
if (result.result !== undefined) {
request.callback(null, result.result);

} else {
Expand Down

0 comments on commit 472e5b0

Please sign in to comment.