Name: Rocket.Chat.PCL
Owner: Rocket.Chat
Description: Portable Class Libraries - Xamarin implementation of the Rocket.Chat Real-Time API
Created: 2017-02-09 17:10:42.0
Updated: 2018-02-28 15:25:39.0
Pushed: 2017-03-18 20:19:29.0
Homepage: null
Size: 78
Language: C#
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
In order to use the bindings, you will need the latest version of Xamarin Studio for Mac or Visual Studio on windows.
MeteorPCL and Rocket.Chat.PCL are currently both distrbuted on the following public MyGet repository. They will be uploaded to nuget.org in the future. For now, you'll need to add the following NuGet feed to your sources:
tps://www.myget.org/F/shauncampbell/api/v2
In the following example we are connecting to demo.rocket.chat, on port 443 (https) with SSL enabled. We connect to the server and print out a list of the subscribed rooms.
g RocketChatPCL;
client = new RocketChatClient("demo.rocket.chat", 443, true);
ent.Connect("testuser", "testpass")
.ContinueWith( (connected) => {
foreach (var room in rc.Rooms.Keys) {
Debug.WriteLine("Room: {0}", rc.Rooms[room].Name);
}
});
There are currently 4 collections:
The user object has the following properties. Depending on the circumstance in which it has been instantitaed it may not always have all of these properties. However User objects retrieved from the user collection should always have these items:
g RocketChatPCL;
client = new RocketChatClient("demo.rocket.chat", 443, true);
ent.Connect("testuser", "testpass")
.ContinueWith( (connected) => {
foreach (var user in rc.Users.Keys) {
Debug.WriteLine("User: {0} is in the '{1} timezone",
rc.Users[user].Username, rc.Users[user].UtcOffset);
}
});
The room object has the following properties:
User
object representing the owner of the room.History (DateTime oldestMessage, int quantity, DateTime lastUpdate);
It is possible to load all messages in the room using this method. You would usually use this method to perform the initial load of messages into your application and then use subscriptions to retrieve messages thereafter.
History(new DateTime(1970, 1, 1), 100, DateTime.Now)
.ContinueWith( (messages) => {
foreach (var msg in messages.Result)
Debug.WriteLine("Message from: {0}: {1}", message.User.Username, message.Text);
});
Message (string message);
This method sends a message to the room.
This library is distributed under the MIT License.