Check AWS Appsync is connected to the endpoint socket - aws-appsync

I am using AWS appsync for chat app. Is there any way be sure that Appsync is connected to the end point socket before sending request? Like onConnect socket event.

The AppSync SDK doesn't maintain an active connection to the endpoint. However, when you subscribe to an object, the SDK creates a WebSocket connection for Subscriptions with GraphQL. If you use AppSync subscriptions and subscribe on an object, the SDK opens a WebSocket connection and keeps the connection alive until the connection is lost due to network failures. This connection makes sure you get the relevant updates on the object you have been subscribed to.
Documentation:
https://docs.aws.amazon.com/appsync/latest/devguide/building-a-client-app-android.html#subscriptions
https://docs.aws.amazon.com/appsync/latest/devguide/building-a-client-app-ios.html#subscriptions

Related

Notification for client connection establishment in server

I am using nghttp2 C++ library (version 1.30) to implement a web server using nghttp2::asio_http2::server. In the deployment many HTTP client connects to the sever and invokes several REST API over time before diconnect. The nghttp2 C++ library provides on_connect which helps to know when the connection is established in the client application.
Is there any simialr way to execute any call back or get notification in the server when the client connects? It is required to get the notification before the REST API is invoked. For example if a client connects and invokes two REST API, the server should be notified once. If I provided handler to server.handle, thats get invoked for each REST API call.
Notification/callback in server code

Signalr update claims

I have an signalr hub with web socket transport and initially it is allowed for unauthenticated users to connect. What I am trying to achieve is to have events to be pushed from the hub to connected clients and user specific events only if there is an authenticated user on that connection.
The hub also exposes some methods that need authorization but the problem is that once hub connection is made there is no way to update current user/claims on that connection.
I am using Jwt Bearer tokens for authentication but I guess the authentication scheme don't play a role.

App that provides a REST API and a TCP/IP socket interface

Is it possible to create an app that provides a REST API and a TCP/IP socket connection interface. I'm new to web related programming but I do have a REST API demo program working and I have created socket servers in the past. I need to create an app that can receive messages via a REST API and forward the message to a machine that is connected via the socket connection. I am working in C# with Visual Studio 2022.
Thank you.

Multiple SignalR Client connections in one Xamarin app management

The problem:
Convenient centralized management of SignalR connections on client side.
What I have is a Xamarin app that authorizes with Azure B2C and connects to the SignalR hub using acquired token.
The idea is that server side will have a multiple hubs (as end points/services) and app should connect to them all.
What I've done is created a base class that has essential hub connection creation logic, hub method calling and async callbacks registration and in this way I create multiple hub clients.
Problem is that I cannot start them on dependency registration to DI container as I need to authorize the user first.
How this could be managed? Does starting all connections one by one is the only possible way?

HTTP service request not closing database connections

we have multiple source application servers from where request comes to our database (using single db user). but there are two application servers from which request comes but not cleaned up as checked in database, for rest of app servers there are request comes and immediately gets cleaned up. After analyzing from all sources that how request is coming to db, we suspect one of source channel from where it is using web-service (uses HTTP request).
As we understood HTTP protocol is a "stateless" connection gets destroyed once it completes activity . But we suspect somehow it is not closing db connections.
Any help will be helpful.