How to connect to API via TCP in reactnative - reactjs

I am new react native and trying to connect to an URL "someurl.com" which is running on port 8051 via TCP.
I have tried it through web socket but its not working.
In iOS they have implemented it by using streams. Below is the code sample in iOS.
CFReadStreamRef readStream;
CFWriteStreamRef writeStream;
CFStreamCreatePairWithSocketToHost(
NULL,
(CFStringRef)/*DemoServer_Client, DemoServer_Client_Port*/ /*DemoServer*/ClientServer,
Client_Production_Port,
&readStream,
&writeStream);
I have tried it by using react-native-tcp npm but it's giving undefined object near Socket.connect. Please see below screenshot.
sockets connect error
Please help me in connecting to this server and getting the response in react-native.
Thanks

Related

How to connecting my web application to socket io in frappe (Docker local development)

So I want to connect my web application that was made from react to frappe. I have already installed the socket io client and connected it to the other socket io server. It was successful when I tried to connect socket io frappe(Docker local development). It always showed "Unable to join chat room. ECONNREFUSED 127.0.0.1:3002". Is there any guide to testing socket io from local? I have already read this wiki https://github.com/frappe/frappe/wiki/How-to-setup-Socketio-for-development-mode
but it's not solving my problem.
this is an error from socket io client
Please anyone help me, thank you in advance!

SignalR IIS With React - "Server returned handshake error: Handshake was canceled."

I am developing a .Net Core (3.1) web application hosted with IIS 10. When I am trying to use SignalR on localhost, I am able to connect totally fine and receive messages from the backend, but after I publish it to IIS, I get the error: "Server returned handshake error: Handshake was canceled." In the client logs on Chrome's console, I get the message: "Information: SSE connected to http://myserver.com/MyApplication/output" before I get the error described above (which you would think means that I connected successfully)...
I have seen other posts where people have suggested that I have to enable webSockets on IIS, and I have already checked the my site has this enabled.
I have also seen people suggest to try using the longPolling argument in the withUrl function when creating the connection, and this has not helped either.
I have also added SignalR Event Log Trace Listeners to my web.config file, and the only warning I get that might be related to this issue is that I get a warning from the .NET runtime that reads "Failed to determine the https port for redirect." I am not sure what this means or if it would be related to SignalR, but as this also appears to deal with Middleware, it might be significant.
One thing that I thought might be related is that my site is just one of multiple hosted on this server, so that when I am running locally, I can use the following to connect to SignalR:
hubConnection = new signalR.HubConnectionBuilder().withUrl("/output").build();
But because of the way this site is deployed on my server, I have to use this:
hubConnection = new signalR.HubConnectionBuilder().withUrl("/MyApplication/output").build();
when I deploy the site or else I get a 404 error...
Would there be any issue there? I noticed when inspecting the network requests that on localhost, the URL to connect with the socket is "wss://localhost:44315/output?id=..." and I get the "Status Code: 101 Switching Protocols", but after I deploy, the url that is used is "http://myserver.com/MyApplication/output?id=..." and I get a "200 OK" just before receiving the error described at the top. Why does wss get used on localhost but http is requested from my client when I deploy?
FINALLY discovered the issue after days of debugging... The reason I was getting a "101" response on localhost and not when published is because 101 is basically the server (IIS in my case) saying "I support web sockets". I realized that because I wasn't getting this when published, web sockets were probably not enabled in IIS. It was weird, however, because I went into IIS manager and it said that web sockets were enabled, but after much more research, I found that you also have to go into "Server Manager" and enable it as well (see here https://learn.microsoft.com/en-us/iis/get-started/whats-new-in-iis-8/iis-80-websocket-protocol-support and follow step by step instructions). I did not realize both were required.

having trouble viewing react app on mobile device

at my wits end here. I am trying to view my react app hosted at: http://localhost:3000 on a mobile device. When I navigate to http://xxx.xxx.xx.x:3000 on my mobile device (x being my ip address) I get the error that the server refused to respond.
-I have tried adding an incoming rule in my windows defender firewall to allow access on port 3000 from tcp connections. Yet the error still persists.
-I have even temporarily attempted to turn off my firewall to test the connection and I still get the same result.
-my mobile and my localhost are on the same network
i have specified an outgoing rule for port 3000 as well
I am using create react app for my boilerplate code so I haven't edited any of the webpack settings. I am hoping someone might have a suggestion for me as to what I can try next?
I used my ipv6 address instead of my ipv4 address which was the incorrect address

Websocket for .NET Winform

Please provide me with a web socket client for .NET Winforms that is compatible with Web API and Microsoft.Websockets package. I have tried with System.Net.WebSockets, Websocket-sharp, and they are not working.
Finally, I found out the cause of the problem. It is that the web socket connection requires two query string parameters.(ws://localhost/api/ws?username=blah&token=blahblahblah). If I specify only one parameter or no parameter at all, then the web socket connection throws 404 error. Don't know why.

Unable to connect to a NATed peer

I've successfully started RendezVous_Hans_A_Multicast_Participant on one PC and on another I've started Edge_Teyacapan_Another_Multicast_Participant but the connection between them is not getting established. Both the PCs are behind the same Wifi router NAT.
Is this the correct way to connect peers behind a Wifi router using JXTA 2.6 ? Am I missing something?
Thank you.
Holly,
Please do use JXTA version 2.7 instead of 2.6. Also, can you post the log messages that JXTA spits out. The messages are very helpful in finding out the problem.
Thanks
DD

Resources