NCALayer.Client
1.0.0
이 문서의 나머지 부분은 그대로 유지됩니다.
웹소켓을 통해 NCALayer와 작업하기 위한 클라이언트
using NCALayer . Client ;
using NCALayer . Client . CommonUtils ;
var client = new NCACommonUtilsClient ( ) ;
var exitEvent = new ManualResetEvent ( false ) ;
client . Ping ( PingCallback ) ;
exitEvent . WaitOne ( ) ;
exitEvent = new ManualResetEvent ( false ) ;
client . RawRequest ( "kz.gov.pki.knca.commonUtils" , "getActiveTokens" , null , GetActiveTokensCallback ) ;
exitEvent . WaitOne ( ) ;
Console . WriteLine ( "Press any key to terminate the program" ) ;
Console . ReadKey ( ) ;
Task PingCallback ( NCAPingResponse response )
{
Console . WriteLine ( $ "NCA Layer { ( response . Success ? string . Empty : "not" ) } launched" ) ;
exitEvent . Set ( ) ;
return Task . CompletedTask ;
}
Task GetActiveTokensCallback ( NCARawResponse response )
{
if ( response . Success )
Console . WriteLine ( $ "Raw response: { response . RawResponse } " ) ;
else
Console . WriteLine ( $ "GetActiveTokensCallback error: { response . ResponseState } " ) ;
exitEvent . Set ( ) ;
return Task . CompletedTask ;
}
더 많은 예제는 샘플/ 폴더에서 찾을 수 있습니다.