Skip to content

Commit

Permalink
Reset formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Samuel committed May 3, 2022
1 parent b850451 commit 680088a
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions assets/js/socket.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
//
// Pass the token on params as below. Or remove it
// from the params if you are not using authentication.
import { Socket } from "phoenix";
import { Socket } from "phoenix"

let socket = new Socket("/socket", { params: { token: window.userToken } });
let socket = new Socket("/socket", { params: { token: window.userToken } })

// When you connect, you'll often need to authenticate the client.
// For example, imagine you have an authentication plug, `MyAuth`,
Expand Down Expand Up @@ -52,17 +52,12 @@ let socket = new Socket("/socket", { params: { token: window.userToken } });
// end
//
// Finally, connect to the socket:
socket.connect();
socket.connect()

// Now that you are connected, you can join channels with a topic:
let channel = socket.channel("topic:subtopic", {});
channel
.join()
.receive("ok", (resp) => {
console.log("Joined successfully", resp);
})
.receive("error", (resp) => {
console.log("Unable to join", resp);
});
let channel = socket.channel("topic:subtopic", {})
channel.join()
.receive("ok", resp => { console.log("Joined successfully", resp) })
.receive("error", resp => { console.log("Unable to join", resp) })

export default socket;
export default socket

0 comments on commit 680088a

Please sign in to comment.