New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support of custom transport #473

Closed
wants to merge 6 commits into
base: master
from

Conversation

4 participants
@speedblue

speedblue commented Oct 6, 2013

Allow to plug a custom remote backend (for example a backend with authentification)

@jharding

This comment has been minimized.

Show comment
Hide comment
@jharding

jharding Feb 9, 2014

Contributor

In v0.10.0, I made it possible to define your own remote transport. So if you wanted to just web sockets for whatever reason, you could do something like:

var source = new Bloodhound({
  remote: {
    url: '/remote',
    send: function(url, o, onSuccess, onError) {
      // use websockets
      // onSuccess should be invoked with the suggestions
      // onError should be invoked if something went wrong
    }
  }
});

source.initialize();

$('.typeahead').typeahead(null, {
  source: source
});

FYI, I'm actually renaming send to transport in v0.10.1 (which should go out tomorrow).

Also, in my implementation, you'll still get rate limiting and caching for free.

Thanks for the pull request and I apologize it took me so long to address it.

Contributor

jharding commented Feb 9, 2014

In v0.10.0, I made it possible to define your own remote transport. So if you wanted to just web sockets for whatever reason, you could do something like:

var source = new Bloodhound({
  remote: {
    url: '/remote',
    send: function(url, o, onSuccess, onError) {
      // use websockets
      // onSuccess should be invoked with the suggestions
      // onError should be invoked if something went wrong
    }
  }
});

source.initialize();

$('.typeahead').typeahead(null, {
  source: source
});

FYI, I'm actually renaming send to transport in v0.10.1 (which should go out tomorrow).

Also, in my implementation, you'll still get rate limiting and caching for free.

Thanks for the pull request and I apologize it took me so long to address it.

@jharding jharding closed this Feb 9, 2014

@redox

This comment has been minimized.

Show comment
Hide comment
@redox

redox Feb 9, 2014

Awesome, thank you @jharding!

redox commented Feb 9, 2014

Awesome, thank you @jharding!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment