Can I create real-time push notifications in C# desktop application? [closed] - c#

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I want to create an application which will be multiple client server application. All the computers are connected via the LAN. I want to generate a push notification on the admin computer when a client makes a query request. The notification should be real-time without loading the dashboard.

If you are up for rolling your own, you could potentially look into RabbitMQ. Its a free open source robust messaging system that would allow you to publish message to an exchange from the admin computer. Then the clients would subscribe to get the notifications/messages.
They have good getting started tutorials over on the main website. In particular, you might want to look at the Publish/Subscribe tutorial
You can use nuget to pick up the offical RabbitMQ C# library. Although, once you have your exchange & queues setup inside RabbitMQ you can even send the messages to the queue from anywhere using HTTP POST messages if you wish.
However, you would need to setup RabbitMQ on a server somewhere which might be a deal breaker if you havent got access to a server to install rabbitMQ on. It would need to sit there in the background to processing the messages for you.
That my 2 pence worth.

Related

Communicate with several ports on a server using multiple threads [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 months ago.
Improve this question
I apologize for the multiple questions but I am having a hard time finding information on exactly what I am trying to do here.
Background:
I am working on a project that involves communicating with several server ports simultaneously that needs to somewhat scale. Some background on the project is I have a web application for users to pass commands to a console application. This console application will then send those commands to a specific port on a preexisting server through a tcp client.
My specific questions regard the console application communicating with the preexisting server.
My idea:
So my idea is to use a producer-many consumers thread scheme. I will need to be able to communicate with up to 300 different ports simultaneously and constantly through TCP connections. This console application will run as a windows service or something along those lines.
Question 1:
I am thinking of using a ConcurrentDictionary<string,ConcurrentQueue>() to track a queue of commands for every specific thread. Is there a better way to do this? I ask because I assume every thread would need access to the entire Dictionary of commands correct? Maybe this is a good approach but I have never done something like this.
Question 2:
Does spawning a single thread for each port I need to send commands to on the server make sense? The only reason I am thinking of doing this is because I will need to keep a TCP connection open for a very long time. The user can choose when to shut down the tool/connection. The only requirement really is this needs to be communicating for days at a time. The MOST I will reach is about 300 threads using this approach.
Question 3:
Obviously using an asynchronous approach is going to be necessary for this to scale well. Can anyone point me to some GOOD not out dated resources of the PROPER way to implement something like this asynchronously. I am willing to even pay for a book / online course if you have a good recommendation. The Microsoft docs are not very helpful because they do a scheme of 1 send and 1 read and then close the tcp connection.

Remote and local databases in C# [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I am working on a WPF application that requires access to a remote database. The problem is:
The app does not have consistent access to the internet
There are multiple instances of the application running
My thought was to get a local copy of the database, log all the interactions with the local database (or someway to queue the interactions for later use), then have the option to sync the remote and local database (send the local commands to the remote database, drop the local database, get the remote database).
This article on MSDN was pretty helpful, but I have some concerns. The main purpose of the queue is to store updates and inserts to the local table, but this route does not look like it stores the parameters for use (has them commented).
Any suggestions or thoughts on the best way to handle this?
Thanks!
You should probably look at message queues (the Microsoft version is called MSMQ and is built into Windows. Other message queues are available). They are designed for exactly this sort of scenario.
Essentially, your application write an event to it's local message queue. This will attempt to send it to the remote queue (on the database in this case) periodically, providing for reliable message delivery.
On the database queue you typically have a listener watching the queue and writing any events it receives to the database.

What pattern/technique do I use for a reactive MVC Razor interface [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
On a whim I wrote the UI for my latest desktop app as an MVC ASP application running on IIS.
It looks really nice.
The application has a button that starts a process that permanently reads a UDP port. The I want the UI to become active and for data to be shown on the UI
In ASP this seem to be a lot more involved than the WinForms way of a background process and updating a form control.
I have considered polling from the UI but that doesn't feel right.
How do I return to the UI so I can (for example) press a stop button?
What technique should I use to push arriving data to the UI?
You should Learn About ASP.NET SignalR
ASP.NET SignalR is a new library for ASP.NET developers that makes
developing real-time web functionality easy. SignalR allows
bi-directional communication between server and client. Servers can
now push content to connected clients instantly as it becomes
available. SignalR supports Web Sockets, and falls back to other
compatible techniques for older browsers. SignalR includes APIs for
connection management (for instance, connect and disconnect events),
grouping connections, and authorization.

What is the right programing model for global chat app? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I am trying to build a chat app in c# that would work in the wan network.
There are 2 side in the app. Server side and client side.
In my thoughts i think that every message from client to client need to be passed to the server and the server will forward it to the right des client. The communications between the clients wont be directelly.
Is this the right model?
If yes, does the server need to have one socket that will listen to all clients? (Because every client sends his message to the same port at server).
Will the sever can handle management of million of messages on same port?
I think it is really up to what you want to accomplish, each choice has it's own pros and cons.
For example:
Using a centralized server can track messages , which users are online etc... but you will have to manage the ports for each connection (see explanation at the end of the answer for details).
Using a P2P model, you will not have the bottle neck and management required by the centralized server, but again it might be more of a hassle to manage a non centralized system (depends what exactly you want to accomplish).
If you are going to the centralized design, Typically You would have a server with a port that will listen for requests.
once a user wants to connect, the server will start a new thread for the client, and will assign a port for him (the thread will be typically from a thread pool and the port from a specific port range).
this will allow users to speak to the server in a non-blocking manner, and by that allow for multiple users to use the service simultaneously.
Take a look at SignalR and the chat system implemented using SignalR, Jabbr:
http://signalr.net/
http://about.jabbr.net/

Implementing RabbitMQ pub sub [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I am trying to incorporate RabbitMQ based pub sub for a specific programming scenario,
I have a Web API endpoint. When I get a 201 response from this service I want to send out emails.
I already have another API endpoint which I can call to send out email.
Where do I setup the mailer?
And how do I setup RabbitMQ to handle this scenario?
To clarify further, should this be a fanout exchange setup or not? And how are mails usually handled transient or persistent queues?
Sounds like a typical worker scenario where one side will queue up jobs/messages into a message queue (producer) and the other side will get the messages and process them (consumer/worker). In your case, the workers will get messages and send out an email (or hit your api endpoint that sends out emails). The workers typically run on separate machines so they can do work without affecting your application or api.
If you're using RabbitMQ, you should read the "Work Queues" tutorial to see how to set it up for your scenario: http://www.rabbitmq.com/tutorials/tutorial-two-python.html
There are some hosted solutions specifically for this too that don't require any setup like IronMQ for a message queue. Or even a step further if you don't want to deal with worker servers, you can use IronWorker.

Categories