Search in sources :

Example 1 with DeviceRegistMessage

use of io.transport.sdk.protocol.message.internal.DeviceRegistMessage in project transporter by wang4ever.

the class TransportClient method registered.

/**
 * 注册客户端连接认证(如:用于Web端ws连接认证)
 *
 * @param expiredSec
 *            过期时间(s)
 * @param deviceIdTokens
 *            多个deviceId
 * @return 通道对象(可用于控制同步发送方案: registered(..).sync())
 * @throws TransportException
 */
public Future<Message> registered(int expiredSec, String... deviceIdTokens) throws TransportException {
    if (!(deviceIdTokens != null && deviceIdTokens.length != 0))
        throw new TransportException("The 'deviceIdTokens' is not allowed to be empty.");
    if (expiredSec <= 0)
        throw new TransportException("'expiredSec' is invalid.");
    DeviceRegistMessage msg = new DeviceRegistMessage();
    msg.setAppId(this.config.getAppId());
    msg.setExpired(expiredSec);
    msg.setClientDeviceIds(Arrays.asList(deviceIdTokens));
    return this.execute(msg, true);
}
Also used : TransportException(io.transport.sdk.exception.TransportException) DeviceRegistMessage(io.transport.sdk.protocol.message.internal.DeviceRegistMessage)

Example 2 with DeviceRegistMessage

use of io.transport.sdk.protocol.message.internal.DeviceRegistMessage in project transporter by wang4ever.

the class TransportClients method registered.

/**
 * 注册客户端连接认证(如:用于Web端ws连接认证)
 *
 * @param expiredSec
 *            过期时间(s)
 * @param deviceIdTokens
 *            多个deviceId
 * @return 通道对象(可用于控制同步发送方案: registered(..).sync())
 * @throws TransportException
 */
public Future<Message> registered(int expiredSec, String... deviceIdTokens) throws TransportException {
    if (!(deviceIdTokens != null && deviceIdTokens.length != 0))
        throw new TransportException("The 'deviceIdTokens' is not allowed to be empty.");
    if (expiredSec <= 0)
        throw new TransportException("'expiredSec' is invalid.");
    DeviceRegistMessage msg = new DeviceRegistMessage();
    msg.setAppId(this.config.getAppId());
    msg.setExpired(expiredSec);
    msg.setClientDeviceIds(Arrays.asList(deviceIdTokens));
    return this.execute(msg, true);
}
Also used : TransportException(io.transport.sdk.exception.TransportException) DeviceRegistMessage(io.transport.sdk.protocol.message.internal.DeviceRegistMessage)

Aggregations

TransportException (io.transport.sdk.exception.TransportException)2 DeviceRegistMessage (io.transport.sdk.protocol.message.internal.DeviceRegistMessage)2