Forum Xamarin.Forms


The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

How to use Socket.IO Client .NET

i am creating a new chat Messenger but i am not understand how to use Socket.IO Client .NET in my app plz Help


  • tribaltribal USMember ✭✭✭

    Do you have any specific reason for using the Socket .IO library. There seems to be a an implementation of it for C#(socketio4net) but its not maintained now. Not sure if its PCL compatible either.

    There are a few others for .NET as well notably Alchemy-Websockets & SuperWebSocket but I am not sure if they're PCL or .NET Standard compliant which you will need for using in Xamarin.

    By the way there are also a couple of open source Xamarin Chat applications but they're Azure/Twilio based



  • SinghsumitSinghsumit INMember ✭✭

    @tribal Very Thanks, Alchemy-Websockets & SuperWebSocket free or Not.

  • tribaltribal USMember ✭✭✭

    @Singhsumit both are open source and free.

  • SinghsumitSinghsumit INMember ✭✭

    @tribal thanks :smile:

  • AjaysinhDodiyaAjaysinhDodiya INMember ✭✭
    edited March 2018

    Alchemy-Websockets & SuperWebSocket is compatible with .Net standard

  • joscojosco Member ✭✭

    I am using this Nuget:

    My solution is this.
    I Have an api with node js and my app.js looks like this:

    var express = require('express');
    var bodyParser = require('body-parser');
    // create express app
    var app = express();
    var fs = require('fs');
    // parse requests of content-type - application/x-www-form-urlencoded
    app.use(bodyParser.urlencoded({ extended: true }))
    // parse requests of content-type - application/json
    app.use(express.static(__dirname + '/public'));
    // Configuring the database
    var dbConfig = require('./config/database.config.js');
    var mongoose = require('mongoose');
    mongoose.Promise = global.Promise;
    mongoose.connect(dbConfig.url, {
        useMongoClient: true
    mongoose.connection.on('error', function() {
        console.log('Could not connect to the database. Exiting now...');
    mongoose.connection.once('open', function() {
        console.log("Successfully connected to the database");
    // define a simple route
    app.get('/', function(req, res){
        //res.json({"message": "Welcome to MexiRoomies application. Take notes quickly. Organize and keep track of all your notes."});
       //Telling Browser That The File Provided Is A HTML File
      //Passing HTML To Browser
      //Ending Response
    // Require Posts routes
    // Require Users routes
    // Require Conversations routes
    // listen for requests
    /*app.listen(3000, function(){
        console.log("Server is listening on port 3000");
    var io = require('').listen(app.listen(3000));
    //For Tracking When User Connects:
    //var socket is the socket for the client who has connected.
        console.log("new connection");
    //For Tracking When User Disconnects:
        //var socket is the socket for the client who has disconnected.

    And my class for connect in xamarin pcl looks like this:

    using System;
    using Quobject.SocketIoClientDotNet.Client;
    namespace MexiRoomies.SocketIO
        public class Client
            public Client(string pIpAddress, int port)
                var socket = IO.Socket("http://"+pIpAddress+":"+port);
                socket.On( Socket.EVENT_CONNECT, () =>
                socket.On("hi", (data) =>

    So when I instantiate my client class


    where Constants.MEXIROOMIES_API_HOST_NAME = "" change this for your hostname without the http//:
    and Constants.MEXIROOMIES_API_PORT = 3000 change 3000 for your host port

    the result in the node js server console looks like this:

  • amou43amou43 Member

    @josco thank you for the example.
    I tried to do the same, i add the SocketioClientDotNet Nuget in my common xamarin projet and when i try to lauch it on my iphone i get : "Could not link assemblies"
    Thank you

  • joscojosco Member ✭✭

    @amou43 said:
    @josco thank you for the example.
    I tried to do the same, i add the SocketioClientDotNet Nuget in my common xamarin projet and when i try to lauch it on my iphone i get : "Could not link assemblies"
    Thank you

    Hi, try with 1.0.5 version on all your projects

    this is how my project looks like:

    this is how ios build settings looks like:

    I have to mention that my project is not using code sharing strategy .Net standard , it is using Shared project strategy and I haven't tested this nuget with .Net standar but a believe that should work also with .Net standar

  • Want to add Chat functionality in Xamarin.Forms App for Android/iOS, implemented Node.JS Server for (version 2.0), but can't find any suitable client for Xamarin.Forms (for version 2.0).

Sign In or Register to comment.