21 lines
656 B
C#
21 lines
656 B
C#
// Copyright (c) .NET Foundation. All rights reserved.
|
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
|
|
|
using System.Threading.Tasks;
|
|
using Microsoft.AspNet.SignalR;
|
|
|
|
namespace SignalRServer
|
|
{
|
|
public class EchoConnection : PersistentConnection
|
|
{
|
|
protected override Task OnConnected(IRequest request, string connectionId)
|
|
{
|
|
return Connection.Send(connectionId, "Welcome!");
|
|
}
|
|
|
|
protected override Task OnReceived(IRequest request, string connectionId, string data)
|
|
{
|
|
return Connection.Broadcast(data);
|
|
}
|
|
}
|
|
} |