本文整理汇总了Java中com.pusher.client.PusherOptions类的典型用法代码示例。如果您正苦于以下问题:Java PusherOptions类的具体用法?Java PusherOptions怎么用?Java PusherOptions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PusherOptions类属于com.pusher.client包,在下文中一共展示了PusherOptions类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: PusherClient
import com.pusher.client.PusherOptions; //导入依赖的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.PusherOptions; //导入依赖的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.PusherOptions; //导入依赖的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: onCreate
import com.pusher.client.PusherOptions; //导入依赖的package包/类
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_about);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
TextView versionView = (TextView)findViewById(R.id.label_version);
versionView.setText("pusher-java-client version: " + PusherOptions.LIB_VERSION);
versionView.invalidate();
}
开发者ID:pusher,项目名称:pusher-test-android,代码行数:11,代码来源:AboutActivity.java
示例5: setOptions
import com.pusher.client.PusherOptions; //导入依赖的package包/类
/** Options for the Pusher client library to use. */
public PusherBuilder setOptions(PusherOptions options) {
this.options = options;
return this;
}
开发者ID:uPhyca,项目名称:idobata4j,代码行数:6,代码来源:PusherBuilder.java
示例6: PusherBinder
import com.pusher.client.PusherOptions; //导入依赖的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.PusherOptions类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论