Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can ' t get data from channel.listen callBack #14

Open
codeCarbConoisseur opened this issue Aug 12, 2020 · 4 comments
Open

Can ' t get data from channel.listen callBack #14

codeCarbConoisseur opened this issue Aug 12, 2020 · 4 comments

Comments

@codeCarbConoisseur
Copy link

I' m creating an Echo instance with params
then a add
echo.connected( callback: { (data, ack) in
print("connected")
let channel = self.echo.privateChannel(channel: "myChannel"
channel.listen(event: "ChatMessage") { (data,ack) in
print(data)
}
})
I successfully have logs that I m connected to channel and subscribed to my "ChatMessage" event, and also I receive messages from my chat(in Logs), but i can't get data from callback! idk why , but it s not working! plz help me!
the code doesn't go inside the callback, I checked with debugger

@thuanuit96
Copy link

I' m creating an Echo instance with params
then a add
echo.connected( callback: { (data, ack) in
print("connected")
let channel = self.echo.privateChannel(channel: "myChannel"
channel.listen(event: "ChatMessage") { (data,ack) in
print(data)
}
})
I successfully have logs that I m connected to channel and subscribed to my "ChatMessage" event, and also I receive messages from my chat(in Logs), but i can't get data from callback! idk why , but it s not working! plz help me!
the code doesn't go inside the callback, I checked with debugger

i � get the same issue . if you resolved . Please share solution with me
Thank you so much.

@rutim7
Copy link

rutim7 commented Aug 25, 2020

I' m creating an Echo instance with params
then a add
echo.connected( callback: { (data, ack) in
print("connected")
let channel = self.echo.privateChannel(channel: "myChannel"
channel.listen(event: "ChatMessage") { (data,ack) in
print(data)
}
})
I successfully have logs that I m connected to channel and subscribed to my "ChatMessage" event, and also I receive messages from my chat(in Logs), but i can't get data from callback! idk why , but it s not working! plz help me!
the code doesn't go inside the callback, I checked with debugger

When you instantiate Echo client you should obviously set some namespace. For example:
let e : Echo = Echo(options: ["host":"http://localhost:6001", "auth": ["headers": ["Authorization": "Bearer " + token]], "namespace": "App//Events" ])

@thekingofsofa
Copy link

thekingofsofa commented Oct 8, 2020

Same here, adding namespace not helping, I see in logs that room connected, events are Handling in Logs, but callback of .listen doesn't firing...

Update:
Yeah for me after all was naming issue, eventFormatter from lib, was formatting a bit wrongly for my case, so if you have some problems with this look into eventFormatter inside lib!

@thuanuit96
Copy link

thuanuit96 commented Oct 19, 2020

Change namespace like @rutim7 will work fine . Thank you so much .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants