Ending Game Process

Last updated: 2021-01-21 11:07:49

    API Name

    OnProcessTerminate

    API Description

    This API is used for GSE to tell the game process to end itself during reduction or if health check keeps failing. After the game process receives the request, it needs to end the GameServerSession which it sustains on OnStartGameServerSession, and call the two GSE APIs TerminateGameServerSession and ProcessEnding to tell GSE to end the game server session and the process.

    Request Message

    // End the game process
    message ProcessTerminateRequest {
        int64 terminationTime = 1;
    }

    Response Message

    message GseResponse

    Field Description

    ProcessTerminateRequest
    Field Name Type Description
    terminationTime Int64 Time (timestamp) after which GSE will end the process.
  • If the server fleet is under full protection, the time will be ignored.
  • If the server fleet is under time-period protection, the time will be the protection period.
  • If the server fleet is under no protection, the time will be 5 minutes by default.
  • Sample

    func (s *rpcService) OnProcessTerminates(ctx context.Context, req *grpcsdk.ProcessTerminateRequest) (*grpcsdk.GseResponse, error) {
       s.TerminationTime = req.TerminationTime  
       conn, _ := grpc.DialContext(context.Background(), LOCAL_ADDRESS, grpc.WithInsecure())
       defer conn.Close()
       cli := grpcsdk.NewGseGrpcSdkServiceClient(conn)
    
       request := &grpcsdk.ProcessEndingRequest{  // Inform GSE that the process is being ended.
       }
    
       return cli.ProcessEnding(getContext(), request)
    }