Comments (7)
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.
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.
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.
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.
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.
That's totally what I mean.
from centrifuge.
Please check out pr #61
from centrifuge.
Related Issues (20)
- ServerJoin event not sent HOT 4
- client.send(data) disconnects clients on empty data HOT 2
- Occasional data race in `initMetricsRegistry` HOT 1
- Clients being disconnected due to "Slow" reason - throttling options HOT 14
- Redis broker pool size HOT 4
- KeyDB connect HOT 3
- private channel HOT 2
- Deprecated ProtocolVersion1 will be removed soon HOT 1
- Client level heartbeat config HOT 7
- Custom recover at connection level HOT 4
- High memory consumption HOT 7
- Apply suggestions from fieldalignment for frequently used objects HOT 1
- Making send call to return a reply HOT 1
- Publish() causes a runtime error when no client subscribed to then channel. HOT 2
- [feature] presence with massive amount of active users HOT 6
- Remove SockJS transport HOT 1
- Embed Gorilla WebSocket HOT 1
- How Many Concurrent RPC Requests can server handle? HOT 2
- [feature] Return error when publishing with incorrect history TTL + history meta TTL configuration
- [bug] Investigate occasional panic in tests
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from centrifuge.