use of com.tvd12.ezyfox.constant.EzyConstant in project ezyfox-server by youngmonkeys.
the class EzyCloseSessionImpl method doSendToClients.
protected void doSendToClients(EzySession session, EzyConstant reason) {
EzyResponse response = newResponse(reason);
context.sendNow(response, session);
}
use of com.tvd12.ezyfox.constant.EzyConstant in project ezyfox-server by youngmonkeys.
the class EzyAbstractResponseApi method secureResponse.
protected final void secureResponse(EzyPackage pack, boolean immediate) throws Exception {
EzyConstant connectionType = getConnectionType();
Collection<EzySession> recipients = pack.getRecipients(connectionType);
if (recipients.isEmpty()) {
return;
}
byte[] messageContent = dataToMessageContent(pack.getData());
if (immediate) {
for (EzySession session : recipients) {
byte[] bytes = encryptMessageContent(messageContent, session.getSessionKey());
session.sendNow(createPacket(bytes, pack));
}
} else {
for (EzySession session : recipients) {
byte[] bytes = encryptMessageContent(messageContent, session.getSessionKey());
session.send(createPacket(bytes, pack));
}
}
}
use of com.tvd12.ezyfox.constant.EzyConstant in project ezyfox-server by youngmonkeys.
the class EzyAbstractStreamingApi method response.
@Override
public void response(EzyBytesPackage pack) throws Exception {
EzyConstant connectionType = getConnectionType();
Collection<EzySession> recipients = pack.getRecipients(connectionType);
if (recipients.isEmpty()) {
return;
}
byte[] bytes = pack.getBytes();
for (EzySession session : recipients) {
session.send(createPacket(bytes, pack));
}
}
use of com.tvd12.ezyfox.constant.EzyConstant in project ezyfox-server by youngmonkeys.
the class EzySimpleAppUserDelegate method newExitedAppResponse.
protected EzyResponse newExitedAppResponse(EzyConstant reason) {
EzyExitedAppParams params = new EzyExitedAppParams();
EzyAppSetting appSetting = appContext.getApp().getSetting();
params.setApp(appSetting);
params.setReason(reason);
return new EzyExitedAppResponse(params);
}
use of com.tvd12.ezyfox.constant.EzyConstant in project ezyfox-server by youngmonkeys.
the class EzySimpleAppUserDelegate method responseUserRemoved.
protected void responseUserRemoved(EzyUser user, EzyConstant reason) {
EzyResponse response = newExitedAppResponse(reason);
EzyZoneContext zoneContext = appContext.getParent();
zoneContext.send(response, user, false);
}
Aggregations