static async void Test() { //string appId = "Eohx7L4EMfe4xmairXeT7q1w-gzGzoHsz"; //string appKey = "GSBSGpYH9FsRdCss8TGQed0F"; string appId = "FQr8l8LLvdxIwhMHN77sNluX-9Nh9j0Va"; string appKey = "MJSm46Uu6LjF5eNmqfbuUmt6"; AVRealtime.WebSocketLog(Console.WriteLine); AVClient.HttpLog(Console.WriteLine); AVClient.Initialize(appId, appKey); Websockets.Net.WebsocketConnection.Link(); var realtime = new AVRealtime(new AVRealtime.Configuration { ApplicationId = appId, ApplicationKey = appKey }); AVLiveQuery.Channel = realtime; var query = new AVQuery <AVObject>("GameObject").WhereEqualTo("objectId", "5cedee8e58cf480008de9caa"); //var query = new AVQuery<AVObject>("GameObject").WhereExists("objectId"); liveQuery = await query.SubscribeAsync(); liveQuery.OnLiveQueryReceived += OnLiveQueryReceived; Console.WriteLine("done"); }
protected TestBase() { AVClient.HttpLog(Console.WriteLine); AVRealtime.WebSocketLog(Console.WriteLine); AVClient.Initialize(AppId, AppKey); CNRealtime = new AVRealtime(AppId, AppKey); }
public Form1() { InitializeComponent(); var coreConfig = new AVClient.Configuration { ApplicationId = appId, ApplicationKey = appId, }; AVClient.Initialize(coreConfig); AVClient.HttpLog(AppendLogs); var realtimeConfig = new AVRealtime.Configuration() { ApplicationId = appId, ApplicationKey = appkey, OfflineMessageStrategy = AVRealtime.OfflineMessageStrategy.UnreadAck, }; Websockets.Net.WebsocketConnection.Link(); AVRealtime.WebSocketLog(AppendLogs); realtime = new AVRealtime(realtimeConfig); lbx_messages.DisplayMember = "Content"; lbx_messages.ValueMember = "Id"; lbx_messages.DataSource = data; realtime.OnOfflineMessageReceived += Realtime_OnOfflineMessageReceived; }
public LeanCloudRealtimeHelper(string appId, string appKey, string clientId) { AVClient.Initialize(appId, appKey); realtime = new AVRealtime(appId, appKey); AVRealtime.WebSocketLog(Console.Write); }
public static async Task Main(string[] args) { string appId = "uay57kigwe0b6f5n0e1d4z4xhydsml3dor24bzwvzr57wdap"; string appKey = "kfgz7jjfsk55r5a8a3y4ttd3je1ko11bkibcikonk32oozww"; string clientId = "wujun"; AVClient.Initialize(appId, appKey); AVRealtime realtime = new AVRealtime(appId, appKey); AVRealtime.WebSocketLog(Console.WriteLine); AVIMClient tom = await realtime.CreateClientAsync(clientId, tag : "Mobile", deviceId : "xxxbbbxxx"); tom.OnSessionClosed += Tom_OnSessionClosed; var conversation = await tom.GetConversationAsync("5b83a01a5b90c830ff80aea4"); var messages = await conversation.QueryMessageAsync(limit : 10); var afterMessages = await conversation.QueryMessageAfterAsync(messages.First()); var earliestMessages = await conversation.QueryMessageFromOldToNewAsync(); var nextPageMessages = await conversation.QueryMessageAfterAsync(earliestMessages.Last()); var earliestMessage = await conversation.QueryMessageFromOldToNewAsync(limit : 1); var latestMessage = await conversation.QueryMessageAsync(limit : 1); var messagesInInterval = await conversation.QueryMessageInIntervalAsync(earliestMessage.FirstOrDefault(), latestMessage.FirstOrDefault()); Console.ReadKey(); }
public virtual void SetUp() { string appId = "cfpwdlo41ujzbozw8iazd8ascbpoirt2q01c4adsrlntpvxr"; string appkey = "lmar9d608v4qi8rvc53zqir106h0j6nnyms7brs9m082lnl7"; //string appId = "EB23wEzd6WPhGlwjMVgEPxg6-gzGzoHsz"; //string appkey = "6jEGd98CIOUyH6LQrotQSNVb"; Websockets.Net.WebsocketConnection.Link(); var coreConfig = new AVClient.Configuration { ApplicationId = appId, ApplicationKey = appId, }; AVClient.Initialize(coreConfig); AVClient.HttpLog(AppendLogs); var realtimeConfig = new AVRealtime.Configuration() { ApplicationId = appId, ApplicationKey = appkey, RealtimeServer = new Uri("wss://rtm51.leancloud.cn"), OfflineMessageStrategy = AVRealtime.OfflineMessageStrategy.Default }; AVRealtime.WebSocketLog(AppendLogs); realtime = new AVRealtime(realtimeConfig); }
// Use this for initialization void Start() { _instance = this; // 使用 AppId 和 App Key 初始化 SDK _avRealtime = new AVRealtime(AppId, AppKey); // 方便调试将 WebSocket 日志打印在 Debug.Log 控制台上 AVRealtime.WebSocketLog(Debug.LogWarning); }
public static void Main(string[] args) { Console.WriteLine("Hello World!"); AVRealtime.WebSocketLog(Console.WriteLine); Websockets.Net.WebsocketConnection.Link(); Test(); Console.ReadKey(true); }
public override void OnExecute(CommandLineApplication app, IConsole console) { AVRealtime.WebSocketLog((str) => { console.WriteLine(str); }); console.WriteLine("app inited."); }
public async Task OnExecuteAsync(CommandLineApplication app, IConsole console) { AVClient.Initialize(AppId, AppKey); AVRealtime.WebSocketLog((str) => { console.WriteLine(str); }); AVRealtime realtime = new AVRealtime(AppId, AppKey); AVIMClient client = await realtime.CreateClientAsync(ClientId); client.OnMessageReceived += Client_OnMessageReceived; new RealtimeCommand().OnExecute(app, console); }
public void SetUp() { AVRealtime.WebSocketLog(Console.WriteLine); AVClient.HttpLog(Console.WriteLine); AVClient.Initialize(AppId, AppKey, Server); Websockets.Net.WebsocketConnection.Link(); var realtime = new AVRealtime(new AVRealtime.Configuration { ApplicationId = AppId, ApplicationKey = AppKey }); AVLiveQuery.Channel = realtime; }
// Use this for initialization void Start() { var sc = GameObject.FindObjectOfType <MyWebSocketClient>(); var config = new AVRealtime.Configuration() { ApplicationId = "uay57kigwe0b6f5n0e1d4z4xhydsml3dor24bzwvzr57wdap", ApplicationKey = "kfgz7jjfsk55r5a8a3y4ttd3je1ko11bkibcikonk32oozww", WebSocketClient = sc // 使用已经初始化的 WebSocketClient 实例作为 AVRealtime 初始化的配置参数 }; AVRealtime.WebSocketLog(UnityEngine.Debug.Log); RealtimeInstance = new AVRealtime(config); RealtimeInstance.RegisterMessageType <Emoji>(); RealtimeInstance.RegisterMessageType <NikkiMessage>(); }
public async Task OnExecuteAsync(CommandLineApplication app, IConsole console) { AVClient.Initialize(AppId, AppKey); AVRealtime.WebSocketLog((str) => { console.WriteLine(str); }); AVRealtime realtime = new AVRealtime(AppId, AppKey); AVIMClient client = await realtime.CreateClientAsync(ClientId); var conversation = await client.GetConversationAsync("5b83a01a5b90c830ff80aea4"); await conversation.SendImageAsync("http://ww3.sinaimg.cn/bmiddle/596b0666gw1ed70eavm5tg20bq06m7wi.gif", "Satomi_Ishihara", "萌妹子一枚", new Dictionary <string, object> { { "actress", "石原里美" } }); new RealtimeCommand().OnExecute(app, console); }
static async void Test() { AVRealtime.WebSocketLog(Console.WriteLine); Websockets.Net.WebsocketConnection.Link(); var appId = "Eohx7L4EMfe4xmairXeT7q1w-gzGzoHsz"; var appKey = "GSBSGpYH9FsRdCss8TGQed0F"; AVClient.Initialize(appId, appKey); var realtime = new AVRealtime(appId, appKey); var client = await realtime.CreateClientAsync("lean"); client.OnMessageReceived += (sender, e) => { var msg = e.Message; if (msg is AVIMMessage) { Console.WriteLine((msg as AVIMMessage).Content); } }; var conv = await client.CreateConversationAsync("cloud"); Console.WriteLine($"conversation id: {conv.ConversationId}"); }
public WebSocketLogViewModel() { AVRealtime.WebSocketLog(AppendLog); }
public void SetUp() { AVClient.HttpLog(Console.WriteLine); AVRealtime.WebSocketLog(Console.WriteLine); }