Jun 5, 2013 at 8:49 PM
Can I set the UserAgent?
Jun 6, 2013 at 12:27 AM
Edited Jun 6, 2013 at 1:28 AM
Sure - in the constructor for Client, pass in a NameValueCollection with values you want to grab on the other end.
You can set any key/value pairs in this fashion. The Client constructor has three overloads - you should see that in intellisense (assuming your using Visual Studio).

Try something along the lines of:
string urlString = "http://yourUrlToSocketServer";
var headers = new NameValueCollection();
headers.Add( "user-agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1529.2 Safari/537.36" );

Client socket = new Client(urlString, headers);
Jun 12, 2013 at 5:51 PM
Thank you for reply.
But errors happen.

Error 1 The best overloaded method match for 'SocketIOClient.Client.Client(string, WebSocket4Net.WebSocketVersion)' has some invalid arguments

Error 2 Argument 2: cannot convert from 'System.Collections.Specialized.NameValueCollection' to 'WebSocket4Net.WebSocketVersion'

Is there a solution?
Jun 12, 2013 at 6:28 PM
Could you please show what your initialization call looks like?

There are four overloaded constructors for Client.
public Client(string url)
public Client(string url, NameValueCollection headers)
public Client(string url, WebSocketVersion socketVersion)
public Client(string url, WebSocketVersion socketVersion, NameValueCollection header)
So calling new Client(url, headers) is working for me as shown. You can see the Fiddler screen capture with the dummy user-agent being applied.
Console.WriteLine("Starting SocketIO4Net Client Events Example...");
string ioServer = string.Format("{0}&UserId={1}", authKey, userId);
var headers = new NameValueCollection
             "Not-REAL-DEMO - Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1529.2 Safari/537.36"
socket = new Client(ioServer, headers);
Fiddler Screen Shot
Jun 13, 2013 at 4:29 AM
Edited Jun 13, 2013 at 4:34 AM
Although I am using Nuget-Packages version 0.6.26, The File that can be downloaded from the top page is Constructors have only two.
// Constructors
        public Client(string url)
            : this(url, WebSocketVersion.Rfc6455)

        public Client(string url, WebSocketVersion socketVersion)
            this.uri = new Uri(url);

            this.socketVersion = socketVersion;

            this.registrationManager = new RegistrationManager();
            this.outboundQueue = new BlockingCollection<string>(new ConcurrentQueue<string>());
            this.dequeuOutBoundMsgTask = Task.Factory.StartNew(() => dequeuOutboundMessages(), TaskCreationOptions.LongRunning);
Do you have newer versions?