CryptoTerminal.io (Dismiss) Loading...

WebSocket Documentation

									
                  <head>
                    <title>Pusher Test</title>
                    <script src="https://js.pusher.com/4.3/pusher.min.js"></script>
                    <script>

                      // Enable pusher logging - don't include this in production
                      Pusher.logToConsole = true;

                      var pusher = new Pusher('api-key', {
                        cluster: 'us2',
                        forceTLS: true
                      });

                      var channel = pusher.subscribe('my-channel');
                      channel.bind('my-event', function(data) {
                        alert(JSON.stringify(data));
                      });
                    </script>
                  </head>
                  
                  

Install using CocoaPods by adding the following to your Podfile:

pod 'libPusher', '~> 1.6.2'
      

Import the Pusher header and start listening for events:

#import <Pusher/Pusher.h>
      
      self.client = [PTPusher pusherWithKey:@"api-key" delegate:self encrypted:YES cluster:@"us2"];

      // subscribe to channel and bind to event
      PTPusherChannel *channel = [self.client subscribeToChannelNamed:@"my-channel"];

      [channel bindToEventNamed:@"my-event" handleWithBlock:^(PTPusherEvent *channelEvent) {
          // channelEvent.data is a NSDictianary of the JSON object received
          NSString *message = [channelEvent.data objectForKey:@"message"];
          NSLog(@"message received: %@", message);
      }];

      [self.client connect];
      

Install using CocoaPods by adding the following to your Podfile:

pod 'PusherSwift'
      

Import PusherSwift and start listening for events:

import PusherSwift

      let options = PusherClientOptions(
        host: .cluster("us2")
      )

      let pusher = Pusher(
        key: "api-key",
        options: options
      )

      // subscribe to channel and bind to event
      let channel = pusher.subscribe("my-channel")

      let _ = channel.bind(eventName: "my-event", callback: { (data: Any?) -> Void in
            if let data = data as? [String : AnyObject] {
                if let message = data["message"] as? String {
                    print(message)
                }
            }
        })

      pusher.connect()
      

Include the library using Gradle by adding the following to your application's build.gradle file:

dependencies {
        compile 'com.pusher:pusher-java-client:1.5.0'
      }
      

Import the Pusher package and start listening for events:

import com.pusher.client.Pusher;
      import com.pusher.client.channel.Channel;
      import com.pusher.client.channel.SubscriptionEventListener;

      PusherOptions options = new PusherOptions();
      options.setCluster("us2");
      Pusher pusher = new Pusher("api-key", options);

      Channel channel = pusher.subscribe("my-channel");

      channel.bind("my-event", new SubscriptionEventListener() {
          @Override
          public void onEvent(String channelName, String eventName, final String data) {
              System.out.println(data);
          }
      });

      pusher.connect();
      

Install PusherJS via NPM:

npm install pusher-js
            

Import the Pusher package and start listening for events:

import Pusher from 'pusher-js/react-native';

            // Enable pusher logging - don't include this in production
            Pusher.logToConsole = true;

            var pusher = new Pusher('api-key', {
              cluster: 'us2',
              forceTLS: true
            });

            var channel = pusher.subscribe('my-channel');
            channel.bind('my-event', function(data) {
              alert(data.message);
            });
            
The channel filters news headlines by symbol.
Example usage - api.news.coins.btc, api.news.coins.eth
The channel filters news headlines by source.
Available sources - twitter, hashtag, rss, ai, scraping, cryptoterminal.
Example usage - api.news.sources.twitter
News carefully filtered by an AI based algorithm.
News filtered by importance threshold.
Available levels - low, normal, high, critical
Example usage - api.news.importance.low
News without any filter.
News filtered by topic.
Available topics - exchange, influential, news, price_action, coin, technical_analysis, corp, hashtag.
Example usage - api.news.topics.exchange
{
  "id": null,
  "author": "BitcoinBirch",
  "text": "Bitcoin ABC and Bitcoin SV are both really trash, non marketable names.Bitcoin Cash is at least a marketable name",
  "content": "Bitcoin ABC and Bitcoin SV are both really trash, non marketable names.Bitcoin Cash is at least a marketable name",
  "importance": "high",
  "link": "",
  "source": "twitter",
  "posted_at": "17:44:33",
  "tag": 0,
  "posted_at_counter": "2018-11-13 17:44:33",
  "paid": null,
  "relevance": 100,
  "channel": "",
  "topic": "news",
  "subtopic": null
}