An XMPP (Extensible Messaging and Presence Protocol) library for Unity 3D targeting C# .NET 2.0, designed to facilitate real-time communication in Unity applications. This library is ideal for implementing chat systems, presence updates, and other real-time messaging features within your Unity projects.
This project represents the first attempt at implementing an XMPP library for Unity 3D targeting .NET 3.5 and earlier versions. It is optimized to work within Unity's Mono runtime environment, which has certain limitations compared to modern .NET environments.
The library supports core XMPP functionalities such as message exchange, presence updates, roster management, and more. It is lightweight, cross-platform, and suitable for use across multiple platforms including PC, Linux, Mac, Android, and iOS.
- Message Exchange: Send and receive messages in real-time.
- Presence Updates: Manage user statuses like online, away, busy, etc.
- Roster Management: Handle contacts and friend lists.
- XML-based Communication: Handles communication with the XMPP server using XML.
- Designed to work seamlessly within Unity's Mono runtime environment.
- Optimized for .NET 2.0, making it compatible with older Unity versions.
- Uses asynchronous callbacks or threads to handle XMPP events without blocking Unity's main thread.
- Authentication: Supports methods like Plain, Digest-MD5, etc.
- 1:1 Chats & Group Chats: Facilitates both personal and group conversations.
- Presence Updates: Manage user availability statuses.
- Roster Management: Add, remove, and manage contacts.
- Extensions: Includes support for MUC (Multi-User Chat), Service Discovery, and PubSub (Publish-Subscribe).
- Lightweight design ensures minimal performance overhead.
- Compatible with multiple platforms: PC, Linux, Mac, Android, iOS.
- Pros:
- Lightweight and compatible with .NET 2.0.
- Simple API for handling XMPP messages.
- Suitable for lightweight chat applications in Unity.
- Cons:
- Lacks some modern features and security protocols (e.g., XMPP over WebSocket).
- Another robust library, but may require licensing for advanced features.
- Compatible with .NET 2.0 and Unity.
- If pre-built libraries are insufficient, you can build an XMPP client from scratch using:
System.Xml
for parsing XML.System.Net.Sockets
for TCP communication.
- Provides flexibility but requires familiarity with the XMPP protocol and its extensions.
- A working XMPP server is required to test this library.
- Read Documentation: Familiarize yourself with the documentation included in this repository.
- Build DLL: Build the DLL file from the Visual Studio solution provided.
- Import DLL into Unity:
- Place the built DLL into the
Assets/Plugins
folder in your Unity project. - Ensure the library is compatible with Unity's .NET 2.0 subset.
- Place the built DLL into the
- Create a Connection: Establish a connection to the XMPP server.
- Authenticate: Authenticate using the desired method (e.g., username/password).
- Subscribe to Events: Subscribe to message and presence events.
- Send and Receive Messages: Send and receive XMPP messages in real-time.
- Standalones: PC, Linux, Mac
- Mobile: Android, iOS
Contributions are welcome! Feel free to fork the repository and submit pull requests. If you encounter any issues or have suggestions for improvements, please open an issue in the repository.
Thank you for putting a star on my repository! 😊
Have a great development day!
This project is licensed under the MIT License - see the LICENSE file for details.
For any questions or feedback, feel free to reach out:
- GitHub Repository: Unity-3D-Xmpp-Protocol-
Happy coding! 🚀