Skip to content

Commit

Permalink
Merge pull request #39 from trixtateam/fix/socket_callback_race_condi…
Browse files Browse the repository at this point in the history
…tion

fix: socket connect callback race conditions
  • Loading branch information
jacqueswho authored Dec 2, 2022
2 parents 7bcec44 + 454c1fc commit 83fc214
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions docs/js/service.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ To communicate with phoenix socket, you can make use of the socket service
import {
socketService,
} from '@trixtateam/phoenix-to-redux';
socketService.initialize('localhost:3000')
socketService.connect()
const socket = socketService.initialize('localhost:3000')
socket.onOpen(function(){ console.info("the socket was opened") });
socket.onError(function(error){ alert("An error occurred") });
socket.connect();

```

0 comments on commit 83fc214

Please sign in to comment.