-
Notifications
You must be signed in to change notification settings - Fork 0
Get Started with Spider
Gilbok Lee edited this page Jun 27, 2014
·
17 revisions
코드네임 Spider는 Hive5 SDK의 실시간(Realtime)기능 지원을 부르는 말입니다.
Hive5Client는 이미 초기화되어 있다고 가정합니다. Hive5Client 초기화는 여기를 참고하세요.
Hive5Spider spider = new Hive5Spider(Hive5Spider.Instance);아래와 같이 호출하면 서버에 연결합니다.
spider.Connect(OnConnected);콜백함수의 예는 아래와 같습니다.
private void OnConnected(bool success)
{
// spider.SessionId 등에 유효한 값이 들어있을 것입니다.
}아래와 같이 호출하면 서버 접속을 끊습니다.
spider.Disconnect(OnDisconnect);콜백함수의 예는 아래와 같습니다.
private void OnDisconnect(bool success)
{
}물론 람다표현식으로 구현 가능합니다.
spider.Disconnect((success) =>
{
// 접속종료됨
});Dictionary<string, object> contents = new Dictionary<string, object>();
contents.Add("message", "testing SendChannelMessage");
spider.SendChannelMessage(contents, (success) =>
{
});Dictionary<string, object> contents = new Dictionary<string, object>();
contents.Add("message", "testing SendPrivateMessage");
spider.SendPrivateMessage(appSecret, contents, (success) =>
{
});Dictionary<string, object> contents = new Dictionary<string, object>();
contents.Add("message", "testing SendNoticeMessage");
spider.SendNoticeMessage(appSecret, contents, (success) =>
{
});Dictionary<string, object> contents = new Dictionary<string, object>();
contents.Add("message", "testing SendSystemMessage");
spider.SendSystemMessage(contents, (success) =>
{
});작성대기중입니다.
작성대기중입니다.
아래와 같이 호출합니다.
spider.GetChannels(OnGetChannels);콜백함수의 예는 아래와 같습니다.
private void OnGetChannels(bool success, CallResult result)
{
GetChannelsResult castedResult = result as GetChannelsResult;
// castedResult.Channels에 접근이 가능합니다.
}아래와 같이 호출합니다.
spider.GetPlayers(OnGetPlayers);콜백함수의 예는 아래와 같습니다.
private void OnGetPlayers(bool success, CallResult result)
{
GetPlayersResult castedResult = result as GetPlayersResult;
// castedResult.PlatformUserIds에 접근이 가능합니다.
}