Skip to content

Commit

Permalink
fix: socket connect callback race conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
jacqueswho committed Dec 2, 2022
1 parent 7bcec44 commit 454c1fc
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 454c1fc

Please sign in to comment.