Coder Social home page Coder Social logo

Comments (7)

FZambia avatar FZambia commented on May 21, 2024 1

So you mean sth like this:

client.On().Publish(func(e centrifuge.PublishEvent) centrifuge.PublishReply {
    // function to modify the Data
    data := modData(e.Data);
    // emit the data
    return centrifuge.PublishReply{Data: data}
})

Right?

from centrifuge.

FZambia avatar FZambia commented on May 21, 2024

Hello, you can publish any payload you need - just be sure it can be encoded into JSON if you are using JSON protocol.

from centrifuge.

OrlandoCo avatar OrlandoCo commented on May 21, 2024

Hello I know I can publish any payload on the client, I mean on the server, I want to add a timestamp from the server to the payload.

from centrifuge.

FZambia avatar FZambia commented on May 21, 2024

That's why you need to properly describe your problem in issues:) As an option you can call RPC from client and construct proper message on server side, then publish it into channel. Will this work for you?

from centrifuge.

OrlandoCo avatar OrlandoCo commented on May 21, 2024

I can make it work, I expected something more straightforward like:

client.On().Publish(func(e centrifuge.PublishEvent) centrifuge.PublishReply {
//function to modify the Data
modData(e);
//emit the data
return centrifuge.PublishReply{e}
})

Obvioulsy the above code makes no sense it's an example, some libraries like socket.io or signalR works this way.

from centrifuge.

OrlandoCo avatar OrlandoCo commented on May 21, 2024

That's totally what I mean.

from centrifuge.

FZambia avatar FZambia commented on May 21, 2024

Please check out pr #61

from centrifuge.

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.