Giter Site home page Giter Site logo

Comments (4)

purehyperbole avatar purehyperbole commented on August 16, 2024 1

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.

purehyperbole avatar purehyperbole commented on August 16, 2024

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.

purehyperbole avatar purehyperbole commented on August 16, 2024

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.

campbellwmorgan avatar campbellwmorgan commented on August 16, 2024

@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)

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.