• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Pusher类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.pusher.client.Pusher的典型用法代码示例。如果您正苦于以下问题:Java Pusher类的具体用法?Java Pusher怎么用?Java Pusher使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Pusher类属于com.pusher.client包,在下文中一共展示了Pusher类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: PusherClient

import com.pusher.client.Pusher; //导入依赖的package包/类
public PusherClient(String key) {

        channels = new HashMap<>();

        PusherOptions options = new PusherOptions();
        pusher = new Pusher(key, options);
        pusher.connect(new ConnectionEventListener() {
            @Override
            public void onConnectionStateChange(ConnectionStateChange change) {
                log("State changed from " + change.getPreviousState() + " to " + change.getCurrentState());
            }

            @Override
            public void onError(String message, String code, Exception e) {
                log("Error: " + message + " (" + code + ")");
            }
        }, ConnectionState.ALL);

    }
 
开发者ID:prog-fun,项目名称:exchange-apis,代码行数:20,代码来源:PusherClient.java


示例2: testInitializeNotificationService_Success

import com.pusher.client.Pusher; //导入依赖的package包/类
@Test
public void testInitializeNotificationService_Success() throws Exception {
    PusherOptions mockPusherOptions = PowerMockito.mock(PusherOptions.class);
    Pusher mockPusher               = PowerMockito.mock(Pusher.class);
    Channel mockChannel             = Mockito.mock(Channel.class);

    PowerMockito.whenNew(PusherOptions.class).withNoArguments().thenReturn(mockPusherOptions);
    Mockito.when(mockPusherOptions.setCluster(Mockito.anyString())).thenReturn(mockPusherOptions);
    Mockito.when(mockPusherOptions.setActivityTimeout(Mockito.anyLong())).thenReturn(mockPusherOptions);
    PowerMockito.whenNew(Pusher.class).withArguments(Mockito.anyString(), Mockito.isA(PusherOptions.class)).thenReturn(mockPusher);
    Mockito.doNothing().when(mockPusher).connect(Mockito.isA(ConnectionEventListener.class), Mockito.isA(ConnectionState.class));
    Mockito.when(mockPusher.subscribe(Mockito.anyString())).thenReturn(mockChannel);
    Mockito.doNothing().when(mockChannel).bind(Mockito.anyString(), Mockito.isA(SubscriptionEventListener.class));

    boolean result = pusherNotificationService.initializeNotificationService(getPlatformAuthDetailsResponseVO);
    assertThat(result).isTrue();

    PowerMockito.verifyNew(PusherOptions.class).withNoArguments();
    Mockito.verify(mockPusherOptions, Mockito.times(1)).setCluster(Mockito.anyString());
    Mockito.verify(mockPusherOptions, Mockito.times(1)).setActivityTimeout(Mockito.anyLong());
    PowerMockito.verifyNew(Pusher.class).withArguments(Mockito.anyString(), Mockito.isA(PusherOptions.class));
    Mockito.verify(mockPusher).connect(Mockito.isA(ConnectionEventListener.class), Mockito.isA(ConnectionState.class));
    Mockito.verify(mockPusher, Mockito.times(1)).subscribe(Mockito.anyString());
    Mockito.verify(mockChannel, Mockito.atLeastOnce()).bind(Mockito.anyString(), Mockito.isA(SubscriptionEventListener.class));
}
 
开发者ID:enjin,项目名称:Enjin-Coin-Java-SDK,代码行数:26,代码来源:PusherNotificationServiceTest.java


示例3: subscribe

import com.pusher.client.Pusher; //导入依赖的package包/类
private void subscribe() {
    String apiKey = "cb65d0a7a72cd94adf1f";

    PusherOptions options = new PusherOptions().setEncrypted(true);
    Pusher pusher = new Pusher(apiKey, options);
    pusher.connect(this);

    // Subscribe to tickers
    pusher.subscribe("ticker.3", this, eventName);   // LTC / BTC
    pusher.subscribe("ticker.132", this, eventName); // DOGE / BTC
    pusher.subscribe("ticker.155", this, eventName); // DRK / BTC

    // Keep main thread asleep while we watch for events or application will terminate
    while (!stop) {
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

}
 
开发者ID:rozza,项目名称:reactiveBTC,代码行数:23,代码来源:Cryptsy.java


示例4: PusherAndroid

import com.pusher.client.Pusher; //导入依赖的package包/类
private PusherAndroid(final String appKey,
                      final PusherAndroidOptions pusherOptions, final PusherAndroidFactory factory) {
    this.pusher = new Pusher(appKey, pusherOptions);
    this.pushNotificationRegistration =
            new PushNotificationRegistration(appKey, pusherOptions, factory, new ManifestValidator());

}
 
开发者ID:pusher,项目名称:pusher-websocket-android,代码行数:8,代码来源:PusherAndroid.java


示例5: build

import com.pusher.client.Pusher; //导入依赖的package包/类
/**
 * Create the {@link com.pusher.client.Pusher} instances.
 */
public Pusher build() {
    if (options == null) {
        return new Pusher(API_KEY);
    }
    return new Pusher(API_KEY, options);
}
 
开发者ID:uPhyca,项目名称:idobata4j,代码行数:10,代码来源:PusherBuilder.java


示例6: IdobataStreamImpl

import com.pusher.client.Pusher; //导入依赖的package包/类
IdobataStreamImpl(Idobata idobata, Pusher pusher, String channelName, Converter converter) {
    this.idobata = idobata;
    this.pusher = pusher;
    this.channelName = channelName;
    this.converter = converter;
    presenceChannel = pusher.subscribePresence(channelName);
}
 
开发者ID:uPhyca,项目名称:idobata4j,代码行数:8,代码来源:IdobataStreamImpl.java


示例7: build

import com.pusher.client.Pusher; //导入依赖的package包/类
@Override
public Pusher build() {
    return pusher;
}
 
开发者ID:uPhyca,项目名称:idobata4j,代码行数:5,代码来源:IdobataTest.java


示例8: PusherBinder

import com.pusher.client.Pusher; //导入依赖的package包/类
public PusherBinder(Client client, String key, String region)
{
    PusherOptions options = new PusherOptions();

    options.setCluster(region);

    Pusher pusher = new Pusher(key, options);

    pusher.connect();

    channel = pusher.subscribe(client.getGame());
}
 
开发者ID:YorkCS2016,项目名称:Antipleurdawn,代码行数:13,代码来源:PusherBinder.java



注:本文中的com.pusher.client.Pusher类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Mapped类代码示例发布时间:2022-05-22
下一篇:
Java Status类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap