client-server screen sharing with gRPC

client-server screen sharing with gRPC

GitHub: RemoteDeskropApp-gRPC

In my previous article about google.protobuf, I introduced a solution for exploring the implementation of the gRPC protocol on both client and server sides. This solution comprises two projects:

  1. Client Side
  2. Server Side

For simplicity, I included the same proto file in both projects:

syntax = "proto3";



service RemoteDesktopService {
    rpc ConnectUser(ConnectUserRequest) returns (ConnectUserResponse);
    rpc DisconnectUser(DisconnectUserRequest) returns (DisconnectUserResponse);
    rpc SendScreenCapture(ScreenCaptureRequest) returns (Empty);
    rpc SendPermissionRequest(PermissionRequest) returns (Empty);
    rpc ListenForNotifications(ConnectUserRequest) returns (stream Notification);
}


message Notification {
    string message = 1; // Notification message
    string senderId = 2;  // ID of the user sending the notification
    string targetId = 3;  // ID of the user getting the notification
    bytes imageData=4;
}


message ScreenCaptureRequest {
    string requesterId = 1; // ID of the client requesting permission
    string targetId = 2; 
    bytes imageData = 3; // The captured screen image data
}
message PermissionRequest {
    string requesterId = 1; // ID of the client requesting permission
    string targetId = 2; 
}


message ConnectUserRequest {
    string userId = 1; // Unique identifier for the user
    string userName = 2; // Display name of the user
}

message ConnectUserResponse {
    bool success = 1; // Indicates if the connection was successful
}

message DisconnectUserRequest {
    string userId = 1; // Unique identifier for the user
}

message DisconnectUserResponse {
    bool success = 1; // Indicates if the disconnection was successful
}

message Empty {}        

this file has 4 methods and 1 notification event.

Implementation Steps

  1. Connecting Users: On the client side, every user connects to the server using the ConnectUser method.
  2. Sending Permission Requests: Client A sends a request to Client B using the SendPermissionRequest.
  3. Accepting Requests: If the target client accepts the request, the process for sending screen captures begins.
  4. Capturing Screenshots: The target client sends screenshots to the server every second.
  5. Notification to Requester: The server notifies the requester client through the ListenForNotifications event.
  6. Receiving and Saving Images: Client A receives images every second and saves them in a designated folder.

Results and Future Applications

This gRPC-based Remote Desktop solution showcases a real-time communication system between clients and a server, effectively facilitating screen sharing and permission management.

By leveraging the gRPC protocol, the application achieves low latency and high efficiency, making it a robust choice for remote desktop solutions.

Feel free to check out the complete implementation on GitHub and share your thoughts or improvements!


#gRPC #RemoteDesktop #RemoteAccess #GoogleProtobuf #RealTimeCommunication #ScreenSharing #SoftwareDevelopment #ClientServerArchitecture #Programming #OpenSource #TechInnovation #CSharp #Networking #SoftwareEngineering #WebDevelopment

Zahra Rastegar

UI UX Designer

4 个月

????

回复

要查看或添加评论,请登录

Navid Abedi的更多文章

  • Compare .NET8 vs Go

    Compare .NET8 vs Go

    it has been a while, I am eager to learn go language. I have heard several things about its performance and simplicity.

  • NextJs Deploy On Windows Server

    NextJs Deploy On Windows Server

    In our company, we started using the NextJs framework five years ago to develop websites. However, due to a lack of…

    2 条评论
  • Essential HTTP Security Headers

    Essential HTTP Security Headers

    One of my colleagues sent me a video about the analyzing the security of websites in LinkedIn. I did the same analyze…

  • What is Google.Protobuf?

    What is Google.Protobuf?

    This week, I was searching for different protocols about sending and receiving data between client and server. as a…

  • Performance Showdown: EF Core vs. Minimal APIs for SQL Server Record Insertion

    Performance Showdown: EF Core vs. Minimal APIs for SQL Server Record Insertion

    EF Core Entity Framework Core (EF Core) is an open-source, lightweight, and extensible version of the Entity Framework,…

  • Benchmarks

    Benchmarks

    as a .NET developer , most of the time I have gotten stuck in my routine works like solving bugs or writings new…

社区洞察

其他会员也浏览了