Protobufs compile
This commit is contained in:
34
Aurora/Backend/Proto/PartyService/party.proto
Normal file
34
Aurora/Backend/Proto/PartyService/party.proto
Normal file
@ -0,0 +1,34 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package Aurora.Backend.Proto;
|
||||
|
||||
// PartyServic definition
|
||||
service PartyService{
|
||||
//Party Service
|
||||
rpc JoinParty(JoinPartyRequest) returns (JoinPartyResponse);
|
||||
rpc LeaveParty(LeavePartyRequest) returns (LeavePartyResponse);
|
||||
}
|
||||
|
||||
message JoinPartyRequest {
|
||||
string clientId = 1;
|
||||
string userName = 2;
|
||||
string ipAddress = 3;
|
||||
string port = 4;
|
||||
}
|
||||
|
||||
message JoinPartyResponse {
|
||||
PartyJoinedStatusEnum status = 1;
|
||||
}
|
||||
|
||||
message LeavePartyRequest {
|
||||
string clientId = 1;
|
||||
}
|
||||
|
||||
message LeavePartyResponse {
|
||||
PartyJoinedStatusEnum status = 1;
|
||||
}
|
||||
|
||||
enum PartyJoinedStatusEnum {
|
||||
Connected = 0;
|
||||
Disconnected = 1;
|
||||
}
|
21
Aurora/Backend/Proto/PlaybackService/playback.proto
Normal file
21
Aurora/Backend/Proto/PlaybackService/playback.proto
Normal file
@ -0,0 +1,21 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package Aurora.Backend.Proto;
|
||||
|
||||
import "Backend/Proto/general.proto";
|
||||
|
||||
service PlaybackService {
|
||||
//Playback Service
|
||||
rpc GetPartyStream(Empty) returns (stream Chunk) {};
|
||||
}
|
||||
|
||||
enum TransferStatusCode {
|
||||
Unknown = 0;
|
||||
Ok = 1;
|
||||
Failed = 2;
|
||||
}
|
||||
|
||||
message TransferStatus {
|
||||
string Message = 1;
|
||||
TransferStatusCode Code = 2;
|
||||
}
|
10
Aurora/Backend/Proto/general.proto
Normal file
10
Aurora/Backend/Proto/general.proto
Normal file
@ -0,0 +1,10 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package Aurora.Backend.Proto;
|
||||
|
||||
message Chunk {
|
||||
bytes Content = 1;
|
||||
}
|
||||
|
||||
message Empty{
|
||||
}
|
10
Aurora/Backend/Services/Server/PartyServiceImpl.cs
Normal file
10
Aurora/Backend/Services/Server/PartyServiceImpl.cs
Normal file
@ -0,0 +1,10 @@
|
||||
using System;
|
||||
using Aurora.Backend.Proto;
|
||||
|
||||
namespace Aurora.Backend.Services.Server
|
||||
{
|
||||
class PartyServiceImpl : PartyService.PartyServiceBase
|
||||
{
|
||||
|
||||
}
|
||||
}
|
10
Aurora/Backend/Services/Server/PlaybackServiceImpl.cs
Normal file
10
Aurora/Backend/Services/Server/PlaybackServiceImpl.cs
Normal file
@ -0,0 +1,10 @@
|
||||
using System;
|
||||
using Aurora.Backend.Proto;
|
||||
|
||||
namespace Aurora.Backend.Services.Server
|
||||
{
|
||||
class PlaybackServiceImpl : PlaybackService.PlaybackServiceBase
|
||||
{
|
||||
|
||||
}
|
||||
}
|
28
Aurora/Backend/Services/Server/ServerService.cs
Normal file
28
Aurora/Backend/Services/Server/ServerService.cs
Normal file
@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using Grpc.Core;
|
||||
using Aurora.Backend.Proto;
|
||||
|
||||
namespace Aurora.Backend.Services.Server
|
||||
{
|
||||
public class ServerService : BaseService<ServerService>
|
||||
{
|
||||
const int Port = 50051;
|
||||
public ServerService()
|
||||
{
|
||||
Grpc.Core.Server server = new Grpc.Core.Server
|
||||
{
|
||||
Services = {
|
||||
PartyService.BindService(new PartyServiceImpl()),
|
||||
PlaybackService.BindService(new PlaybackServiceImpl()) },
|
||||
Ports = { new ServerPort("localhost", Port, ServerCredentials.Insecure) }
|
||||
};
|
||||
server.Start();
|
||||
|
||||
Console.WriteLine("Aurora server listening on port " + Port);
|
||||
Console.WriteLine("Press any key to stop the server...");
|
||||
Console.ReadKey();
|
||||
|
||||
server.ShutdownAsync().Wait();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user