Problems with Presence in the frontend js

phoenix

#1

hello i tried to develop a many chatrooms with elixir-phoenix. All was good, i can communicate in my channels with many users at the same time using token for security.
My problem happening when i tried to add the module “Presence”, apparently in the server all was ok, but in the client, i have the following errors.

Uncaught TypeError: Cannot read property ‘syncDiff’ of undefined
at Object.callback (chat.js:66)
at phoenix.js:619
at Array.map ()
at Channel.trigger (phoenix.js:618)
at phoenix.js:1042
at Array.forEach ()
at phoenix.js:1041
at Socket.decode (phoenix.js:671)
at Socket.onConnMessage (phoenix.js:1027)
at WebSocket.conn.onmessage (phoenix.js:830)

chat.js:61 Uncaught TypeError: Cannot read property ‘syncState’ of undefined
at Object.callback (chat.js:61)
at phoenix.js:619
at Array.map ()
at Channel.trigger (phoenix.js:618)
at phoenix.js:1042
at Array.forEach ()
at phoenix.js:1041
at Socket.decode (phoenix.js:671)
at Socket.onConnMessage (phoenix.js:1027)
at WebSocket.conn.onmessage (phoenix.js:830)

this is my repository if someone wanna help me: https://gitlab.com/Sira5/chatroom
Thanks in advance for all the help that you can bring me


#2

Try

import {Socket, Presence} from "phoenix"

here:

And see if that works.


#3

Manny thanks for the early answer my problem was that :

import Presence from “phoenix”

instead of

import {Presence} from “phoenix”

All solved