using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SuperSocket.SocketBase.Command;
using SuperSocket.SocketBase.Protocol;
namespace SuperWebSocket.SubProtocol
{
///
/// JsonSubCommand
///
/// The type of the json command info.
public abstract class JsonSubCommand : JsonSubCommand
{
}
///
/// JsonSubCommand
///
/// The type of the web socket session.
/// The type of the json command info.
public abstract class JsonSubCommand : JsonSubCommandBase
where TWebSocketSession : WebSocketSession, new()
{
///
/// Gets the json message.
///
/// The session.
/// The content.
///
protected string GetJsonMessage(TWebSocketSession session, object content)
{
return GetJsonMessage(session, Name, content);
}
///
/// Gets the json message.
///
/// The session.
/// The name.
/// The content.
///
protected string GetJsonMessage(TWebSocketSession session, string name, object content)
{
return GetJsonMessage(session, name, session.CurrentToken, content);
}
///
/// Sends the json message.
///
/// The session.
/// The content.
protected void SendJsonMessage(TWebSocketSession session, object content)
{
session.Send(GetJsonMessage(session, content));
}
///
/// Sends the json message.
///
/// The session.
/// The name.
/// The content.
protected void SendJsonMessage(TWebSocketSession session, string name, object content)
{
session.Send(GetJsonMessage(session, name, content));
}
}
}