Make the "receive" function available to caller
See original GitHub issueHello,
I just started playing with phoenix’s channels and found a small issue with this library.
I try to get information from the reply of the “join” call. According to the doc, this could be done using the receive
function :
channel.join()
.receive("ok", resp => { console.log("Joined successfully", resp) })
But when I try to use ember-phoenix
:
const channel = this.joinChannel("room:123", {
nickname: "Mike"
})
.receive("ok", resp => { console.log("Joined successfully", resp) });
this throws a “receive function is not defined”
So I had to make ember-phoenix
return the channel.join()
object instead of the channel
object, and it works. But now, to access the channel
object itself, I have to do this :
const channel = this.joinChannel("room:123", {
nickname: "Mike"
});
// add message handlers
channel.channel.on("notification", () => _onNotification(...arguments));
Is there a more “elegant” way to address this issue ? Thanks !
Issue Analytics
- State:
- Created 7 years ago
- Comments:6
Top Results From Across the Web
Function.prototype.caller - JavaScript - MDN Web Docs - Mozilla
The caller accessor property of Function instances represents the function that invoked this function. For strict, arrow, async, and generator ...
Read more >Call Function (GNU make)
The call function is unique in that it can be used to create new parameterized functions. You can write a complex expression as...
Read more >Make variables declared in caller function available in the ...
For logging purposes, I will write a f2() function that will be called by f1(). My f2() function will refer back to f1()...
Read more >Make & receive phone calls - Phone app Help - Google Support
You can make phone calls from the Phone app and other apps or widgets that show your contacts. Wherever you see a phone...
Read more >How to use low level call for contract function ... - Kush's blog
function myFunction(uint _x, address _addr) public returns(uint, uint) { // do something return (a, b); } // function signature string should ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I just ran into this issue. I ended up writing my own
joinChannel()
method in my service that extendsPhoenixSocket
and made it return aPromise
so that I can know if the connection worked or not:any say on this? @mike-north