Server: Windows Server 2012 with WebSocket support
Client Machine 1: Windows 8.1
Client Machine 2: Windows Server 2008R2
I built a C# application using the SigalR client that I can delpoy on my two client machines. However, the issue that I am running in to is that Client Machine 1 connects using WebSockets, and Client Machine 2 connects using Server Side Events.
How can this be the case? Clearly the server supports WebSockets since Client Machine 1 can connect using them. I don't understand how Client Machine 2 would use SSE.
Using hub.TraceLevel = TraceLevels.All; on my client, I see:
20:57:01.5805156 - null - ChangeState(Disconnected, Connecting)
20:57:02.1117656 - 7ff6f37a-2485-4f08-9c20-872f63964bee - WS Connecting to: wss://internal.soroco.com/signalr/connect?clientProtocol=1.4&transport=webSockets&connectionData=[{"Name":"ClientDaemonHub"}]&connectionToken=Mvbkw1czN7OZSE1jcfFjC2elxYxJhZiTZwisKKn6ZzYv%2BXRjOgfkclRJdSQtPi2wy%2F7XsUyxbCEXPMesFjvE7zh0FrcGwEsh6WTpHlkqB0rXyARnC42Op8ZO3w%2FhuKcB
20:57:02.1273906 - 7ff6f37a-2485-4f08-9c20-872f63964bee - Auto: Failed to connect to using transport webSockets. System.PlatformNotSupportedException: The WebSocket protocol is not supported on this platform.
at System.Net.WebSockets.ClientWebSocket..ctor()
at Microsoft.AspNet.SignalR.Client.Transports.WebSocketTransport.<PerformConnect>d__1.MoveNext()
20:57:02.1273906 - 7ff6f37a-2485-4f08-9c20-872f63964bee - SSE: GET https://internal.soroco.com/signalr/connect?clientProtocol=1.4&transport=serverSentEvents&connectionData=[{"Name":"ClientDaemonHub"}]&connectionToken=Mvbkw1czN7OZSE1jcfFjC2elxYxJhZiTZwisKKn6ZzYv%2BXRjOgfkclRJdSQtPi2wy%2F7XsUyxbCEXPMesFjvE7zh0FrcGwEsh6WTpHlkqB0rXyARnC42Op8ZO3w%2FhuKcB
20:57:02.1430156 - 7ff6f37a-2485-4f08-9c20-872f63964bee - SSE: OnMessage(Data: initialized)
20:57:02.1430156 - 7ff6f37a-2485-4f08-9c20-872f63964bee - SSE: OnMessage(Data: {"C":"d-752B7883-B,0|I,0|J,1","S":1,"M":[]})
20:57:02.4086406 - 7ff6f37a-2485-4f08-9c20-872f63964bee - ChangeState(Connecting, Connected)
20:57:03.5180156 - 7ff6f37a-2485-4f08-9c20-872f63964bee - OnMessage({"R":"497ca302-7375-4250-aa85-fb4ae2556877","I":"0"})
20:57:03.8461406 - 7ff6f37a-2485-4f08-9c20-872f63964bee - OnMessage({"I":"1"})
20:57:04.7523906 - 7ff6f37a-2485-4f08-9c20-872f63964bee - SSE: OnMessage(Data: {})
20:57:05.7523906 - 7ff6f37a-2485-4f08-9c20-872f63964bee - OnMessage({"I":"2"})
20:57:07.7367656 - 7ff6f37a-2485-4f08-9c20-872f63964bee - OnMessage({"I":"3"})
Looks like the relevant error is:
Auto: Failed to connect to using transport webSockets. System.PlatformNotSupportedException: The WebSocket protocol is not supported on this platform.
NET Framework 4.5 on Win7 and Win2008 R2 doesn't support the ClientWebSocket class and this is what the SignalR client uses for websocket transport. Since using websocket fails the client falls back to ServerSentEvents.
Related
I am using Windows Server 2012 R2 on my production server. I upgraded my webapplication to .Net 5.0 from 4.5. Now randomly facing this error, while communication of my front-end applications with the backend REST API built on .Net 5.0:
Exception[System.AggregateException: One or more errors occurred. (The
SSL connection could not be established, see inner exception.)
---> System.Net.Http.HttpRequestException: The SSL connection could not be established, see inner exception.
---> System.Security.Authentication.AuthenticationException: Authentication failed because the remote party sent a TLS alert:
'HandshakeFailure'.
---> System.ComponentModel.Win32Exception (0x80090326): The message received was unexpected or badly formatted.
--- End of inner exception stack trace ---
I have already used the below lines of code in my app:
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12 | SecurityProtocolType.Tls13;
I Am using Java application to connect to WMQ so as to create test suite, which pass message from a file to queue and wait for response from other queue, I am using WMQ V7.0 and ih03_RFHutil package provided by IBM, but after configuring every thing correctly I am getting below error message. It looks like some Authentication issue. Can some one please help me in this.
Below is Logs I have taken using log4j:
2017-03-06 17:26:01 DEBUG Runner_TMH_Tester:108 - initial sleep time 20 tune = 0
2017-03-06 17:26:01 DEBUG Runner_TMH_Tester:108 - connecting to TESTQMGR
2017-03-06 17:26:01 DEBUG Runner_TMH_Tester:108 - MQSeries error with MQCONN on TESTQMGR - compcode = 2, reason = 2058
MQ v7.0 was released June 27th 2008 and has been out of support since September 30th 2015 (almost 1.5 years). The version probably does not have anything to do with your issue but I would strongly suggest that you move to a supported version of the MQ client. Newer MQ client versions can connect to older MQ queue managers. You can download a java only install of MQ 8.0 or MQ 9.0 jar files at the links below:
IBM MQ v8.0 Client
IBM MQ v9.0 Client
The MQ client and queue manager install come with a program called mqrc. You can run this against the MQ return code, in this case 2058 to come up with a more meaning full description:
$ mqrc 2058
2058 0x0000080a MQRC_Q_MGR_NAME_ERROR
This is telling you that TESTQMGR is not the name of the queue manager that exists on the host and port you are connecting too. Verify the queue manager name, hostname, and port are all correct.
MQTT over Websocket protocol
I'm trying to connect IBM Watson IoT service using erlang mqtt websockets on port 443(ssl/tls). But, I was receiving error.
The IBM dos(https://console.ng.bluemix.net/docs/services/IoT/iotplatform_task.html#devices) says that it support websocket connection. There is no mention of the websocket usage(tutorials/guide) except normal tcp connection(which i was successfull at getting conected).
I want a simple step by step doc like the Amazon IoT (http://docs.aws.amazon.com/iot/latest/developerguide/protocols.html) for websocket connectivity as a client application.
I'm figuring about the URL/URI which I think might be improper i.e ws(s)://host:port/path.
Currently, i'm giving it as wss://fybr123mqtt.mybluemix.net
(where fybr123mqtt is my application name).
What is the host, port & path for connecting to IBM Watson IoT through mqtt ?
And how to send other parameters like 'client_id', 'username', 'password', 'authentication token' along with the HOST ?
Also, suggest some erlang websocket client for mqtt and also mention simple steps to access the websocket server. Erlang mqtt client (emqttc) does not support websocket.
The connection process is clearly described here:
console.ng.bluemix.net/docs/services/IoT/devices/mqtt.html
The URL that you mentioned is not correct: wss://fybr123mqtt.mybluemix.net
On Step 2: Connecting your devices to Watson IoT Platform from console.ng.bluemix.net/docs/services/IoT/iotplatform_task.html#devices it says the following:
The following information is required when connecting your device:
URL: org_id.messaging.internetofthings.ibmcloud.com
Where org_id is the ID of your Watson IoT Platform organization.
Port:
1883
8883 (encrypted)
443 (websockets)
Device identifier: d:org_id:device_type:device_id
This combination of parameters uniquely identifies your device.
Username: use-token-auth
This value indicates that you are using token authorization.
Password: Authentication token
This value is the unique token that you defined or that was assigned to your device when you registered it.
The org_id, device_type, device_id and password are provided after you complete Step 1: Registering your device with Watson IoT Platform
Note: The clienID is Device identifier: d:org_id:device_type:device_id
I successfully used mqttfx, eclipse paho, mosquitto and there are a lot of other free mqtt clients that you can use.
Also, there are good tutorials (recipes) that can help you get starter with IBM's client libraries in Java, Pyhton, etc. As examples you can have a look on:
"ibm.com/developerworks/cloud/library/cl-mqtt-bluemix-iot-node-red-app/"
Here is an example for gateway device type with mosquitto
"developer.ibm.com/recipes/tutorials/using-mosquitto-as-a-gateway-for-watson-iot/"
Lets not forget the client nodes from NodeRed, that are very easy to use.
Let me know if you still need help on this.
Thanks,
Daniel
Url: wss://6DigitOrgID.messaging.internetofthings.ibmcloud.com:8883
It works fine using NodeJS. I don't specify a further endpoint.
[BaseClient:connect] Connecting to IoTF with host : wss://6DigitOrgID.messaging.internetofthings.ibmcloud.com:8883
[DeviceClient:connect] DeviceClient Connected
connected
[DeviceClient:publish] Publishing to topic iot-2/evt/myevt/fmt/json with payload {"radiation":1} with QoS 2
This is based off the sample client code with "enforce-ws" : true
I modified that client and tested with 443 also:
[BaseClient:connect] Connecting to IoTF with host : wss://6DigitOrgID.messaging.internetofthings.ibmcloud.com:443
[DeviceClient:connect] DeviceClient Connected
connected
[DeviceClient:publish] Publishing to topic iot-2/evt/myevt/fmt/json with payload {"radiation":1} with QoS 2
I don't know of any samples for erlang.
I try to use the slack-sample bot from this blogpost https://www.opsdash.com/blog/slack-bot-in-golang.html . I've successfully created my api token, but i can not connect to the websocket server (the rtm.start request passs normally). I've get the error message
dial tcp 54.242.95.213:443: connectex: No connection could be made because the target machine actively refused it
I've also tried to connect via a chrome app called Simple Web Socket Client and via a website based one tester. Both work well, i can establish a connection and i can send data.
I'm behind a proxy, but i only have troubles with golang's websocket.Dial function.
Does anybody know why this can happen?
I use:
- Windows 7 SP1 x64
- Golang 1.7.1 windows/amd64
Greetings
Tonka
If you are using gorilla/websocket, it has the ability to use a Proxy. From issue 107:
import "net/http"
...
var dialer = websocket.Dialer{
Proxy: http.ProxyFromEnvironment,
}
If you are using golang.org/x/net you should switch to gorilla/websocket.
Im trying to connect from a client using socket.io :
<script src="https://cdn.socket.io/socket.io-1.3.5.js"></script>
<script>
var socket = io.connect('http://127.0.0.1:8000');
</script>
to a server running websockify to translate websocket traffic to normal tcp, im running it using the latest releases and :
./run 8000 :5000
but this error ocurrs:
WebSocket server settings:
- Listen on :8000
- Flash security policy server
- No SSL/TLS support (no cert file)
- proxying from :8000 to :5000
127.0.0.1 - - [30/Nov/2015 21:23:46] code 405, message Method Not Allowed
from what i have read this happens if you send a POST request to a server that doesnt allow it, is this whats causing this error? is there any way to configure websockify to accept such request?