Comments (4)
Sorry for the delayed response.
You're quite right. that works much better :)
I'lll update the PR with those changes and merge.
Thanks again for the feedback
from sse.
Thanks, happy you like the library!
This is actually something that has bugged me for a while. The stream functionality was included for internal usage at R3 Labs and maybe isn't all that useful to anyone else.
I'm happy to expose functionality to allow custom query parameters, however i'm reluctant to change the default behaviour as i'm not sure who is dependant on that.
Would something like the following work for your usecase?:
// define params as map
params := map[string]string{
"search": "example",
}
c := sse.NewClient("https://someurl")
// set query params, overwriting the default of stream = ?
c.SetQueryParams(params)
from sse.
I've implemented a few changes that keep the current interfaces intact (on the query-params branch), but allow you to specify what query params are set.
The only caveat is that custom params will need to use client.SubscribeRaw
and client.SubscribeStreamRaw
to avoid having the params overwritten with the stream param.
Please let me know if this addresses your use case
Cheers
from sse.
@purehyperbole That looks awesome! Nice work and thanks for getting on this so quickly. Much appreciated!
My only comment is that on thinking about it, perhaps you are over-complicating it because I think here the query
variable will already contain all of the query options from the URL
on the client struct, so in theory all you need is just an if
clause so that an empty query parameter isn't given.
Before I knew you were working on this, I did campbellwmorgan@a5e14a8, but to make it readable you could use your client.SubscribeRaw
which calls client.Subscribe
with an empty stream
variable?
from sse.
Related Issues (20)
- Feature : callback function after client connected
- sse can not get empty data like url opend with chrome HOT 2
- Ignore comments (lines starting with colon - `:`) HOT 1
- Allow overrriding `OnSubscribe` and `OnUnsubscribe` functions per Stream.
- Any idea how to connect with Go Fiber framework?
- SSE client randomly dies HOT 2
- Client doesn't reconnect after EOF HOT 5
- OnConnect can be delayed
- OnConnect can be delayed HOT 1
- Feature Request: Support non-GET method and request body in the sse client HOT 1
- Improve receive message error handling
- Question: Cache mode of SSE client
- Custom http.Client? HOT 1
- Not all empty messages are actually ignored
- Need to process the body and status code of the response with an error
- Introduce EventLog BufferSize HOT 1
- Accessing headers in OnSubscribe HOT 1
- stream connection limits HOT 1
- consequences of the default recoonect strategy behaviour should be documented / made clear
- onSubscribe send a message to the subscriber
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 sse.