Code Monkey home page Code Monkey logo

Comments (3)

dsrees avatar dsrees commented on July 16, 2024

It should. if chan_reply_8 is received, then cancelRefEvent() will be called which will call this.channel.off(this.refEvent)

Not saying there isn't a bug somewhere, but this is at least the intended logic

from javaphoenixclient.

dustinconrad avatar dustinconrad commented on July 16, 2024

The timeout message never triggers the added reply binding is what I am saying. The timeout message looks like PhxMessage(ref=chan_reply_8, topic=, event=, payload={status=timeout}, joinRef=null). Note that the topic and event are empty.

    //In PhxPhush.kt
    /**
     * Triggers an event to be sent through the Channel
     */
    fun trigger(status: String, payload: Payload) {
        val mutPayload = payload.toMutableMap()
        mutPayload["status"] = status

        refEvent?.let {
                                    //ref, topic, event, payload
            val message = PhxMessage(it, "", "", mutPayload)
            this.channel.trigger(message)
        }
    }
    //In PhxChannel.kt
    /**
     * Triggers an event to the correct event binding created by `channel.on("event")
     *
     * @param message: Message that was received that will be sent to the correct binding
     */
    fun trigger(message: PhxMessage) {
        val handledMessage = onMessage(message)
        //the event here is the empty string.  The binding was made for 'chan_reply_8' event.
        this.bindings[message.event]?.forEach { it.second(handledMessage) }
    }

I think if the timeout trigger message was PhxMessage(it, "", refEvent, mutPayload) then things would work as intended. I can open a pull request with a proposed fix and some tests in the next day or two. I wasn't sure what the intended behavior was until your comment.

from javaphoenixclient.

dsrees avatar dsrees commented on July 16, 2024

Resolved in 0.1.8

from javaphoenixclient.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.