public async Task SendMessageToId(string text, string channelSlugUrl, string connectionId) { var data = new ReceiveSocketDataModel { ConnectionId = connectionId, MessageJson = new[] { text }, InvokeMethodName = "SendMessageToId", //System.Reflection.MethodBase.GetCurrentMethod().Name }; await EchoProcess.SendToClientConnectionId(channelSlugUrl, data); }
private static async Task AcceptHub(HttpContext context, Func <Task> next) { if (context.WebSockets.IsWebSocketRequest) { #region subscript var webSocket = await context.WebSockets.AcceptWebSocketAsync(); await EchoProcess.Echo(context, webSocket); #endregion } else { await next(); } }
//[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)] //public string GetCurrentMethod() //{ // System.Diagnostics.StackTrace st = new System.Diagnostics.StackTrace(); // System.Diagnostics.StackFrame sf = st.GetFrame(1); // return sf.GetMethod().Name; //} public override async Task OnConnectedAsync() { //var methodName = new StackTrace().GetFrame(2).GetMethod().Name; var methodName = nameof(this.OnConnectedAsync); #region Reply Connecttion Id var replyConnectionData = new ReceiveSocketDataModel { ConnectionId = Context.ConnectionId, ConnectionName = "", //todo set MessageJson = new[] { RegisWebSocketProcess.GetConnectionRegisListFromSlug(Context.ChannelSlugUrl) }, InvokeMethodName = methodName }; await EchoProcess.SendToClientConnectionId(Context.ChannelSlugUrl, replyConnectionData); #endregion //todo flush this to any client }
static void Main(string[] args) { var process = new EchoProcess(); process.StartProcess(args); }