Im creating a web application that can view a few database tables. You can even update the tables from the web application. Everything works fine, but I want the tables also to be updated in realtime when the tables are changed from another client! And even from my windows application. I've heard that you can use websockets between clients. But Can you also use websockets from a windows program to communicate with a webserver? (on the same computer)
All client examples Ive found so far uses javascript, so I think the answer is no, but hope Im wrong. I was planning to use signalR.
Im writing in C#.
Yes. Websockets are not natively in the .NET library for clients. But there are good 3rd party libraries which are free.
I have used WebSocket4Net. https://websocket4net.codeplex.com/
WebSocket is an official IETF wire protocol that can be used by any language. WebSocket is also a W3C official JavaScript API, but there are other language bindings that mimic the JavaScript standard, e.g., Java, C#, C++, iOS, Android, et al.
The Kaazing Gateway has C#/.NET bindings for WebSocket. Here's the 4.0 binary: http://developer.kaazing.com/downloads/byop-edition-download/
Search for "Kaazing" in Github to get the src.
Full disclosure: I work for Kaazing.
Related
I have the following question, how can I access a device / equipment connected to the client's usb through an application made in Asp .Net MVC? The idea is to access a biometric reader connected to the customer's computer.
I have already looked for some alternatives such as ActiveX and Silverlight, but from what I researched ActiveX works only in I.E and Silverlight seems outdated (at least the tutorials and research related to the subject). I saw that it is possible to work this way with Blazor and Asp .Net Core, but it would be impracticable to change the project at the moment. I thank anyone who can help.
Unfortunately accessing a client's usb could be a tad hard. Browsers generally tend to be sandboxed against hackers. So you can't access hardware devices that easily. Even for accessing a camera the client needs to give explicit permission.
More and more webapi's incoroporate native behaviour however, and one of this is apperently chrome:
https://developers.google.com/web/updates/2016/03/access-usb-devices-on-the-web
Firefox also seems to do its part:
https://developer.mozilla.org/en-US/docs/Web/API/USB
But be careful, because some limitations may apply. For example, HTTPS seems to be a must-have.
What is the best approach to communicate between UWP app (client app) installed on phone and WPF app itself installed on local machine if they are connected to the same router? Files should sync from client to server and vice versa.
As I investigated before there are WCF, Sockets, and Web. So what is the best one to use to create such functionality?
It does not matter if the app is WPF or UWP. To choose framework like WCF or Sockets you need to know how complex your scenario is. If it is rather simple, I would advice agains WCF. It can be unnecessary complicated for basic usage. You can try web api - lite system using JSON. Generally speaking, I do recommend the framework enabling http protocol as it is reusable for almost every scenario. But that is not filter that would help you much :D
For UWP that have not allowed calling localhost and you can use it to communicate to local wpf app.
More details here and here.
But you can make the uwp communicate to local wpf app in debug, see Deploying and debugging Universal Windows Platform (UWP) apps - UWP app developer | Microsoft Docs
If you want your uwp app can use localhost in release that you should use checknetisolation and you can see some way to use wcf in the article.
I've got some piece of hardware that uses ModbusRTU. Using a TCP/IP Gateway for ModbusRTU I can now control the hardware using my C# application over TCP/IP. This works.
Now I would like to control it with my android phone.
Yes, I could make an Android app, what should be no problem for me, but I want to make it more special for myself to fix it with the web browser. That way I'm even more flexible since other OS's should be no problem too.
I'm interested where I should start looking if I want to control the hardware by using the web browser. What programming language, what are the server requirements.
Please mind that I've have very little experience with web browser programming but I'm eager to learn it. Did just some very simple things with PHP / Ajax.
Fyi, the ModbusTCP packeds are really simple, I only control some lights on/off/dimming at my home and to enable some equipment.
I am currently playing with the Marmalade Quick beta which can open a TCP port in Lua. This is a simple high level language, with a build system for Android.
http://quick-docs.madewithmarmalade.com/
Which Modbus lighting controller are you using?
I'm in the initial phase of designing an application that will have a backend implemented in C# that will provide data for other platforms using WCF web services hosted on IIS. One of the platforms will the the iPhone.
Since it's a personal project, I want to use it to learn MongoDB. I already know that there are community developed drivers for MongoDB and C#, so I could handle the persistence on the server side using MongoDB.
Without even knowing the replications models offered by MongoDB, I was thinking about some kind of simple synchronization model to keep data local if the iPhone is not connected or has a poor connection.
Here's the question: Can MongoDB be used in the iPhone using the MongoDB C drivers? Has anybody already tried that?
The typical iPhone architecture is to have your application call out to a web service. Even if it is possible to use a MongoDB driver directly from a mobile client I would not recommend it. For a few reasons.
You are basically talking about doing client server architecture where your client application talks directly to the datastore (MongoDB.) What about security? When any authenticated client talks directly to the datastore all sorts of bad things can happen.
Tightly coupling your client application directly to any given data access technology is dangerous in that it would require you to rewrite your client if for some reason you needed to change your data access solution.
It is more common these days to have your client applications go through a data access tier and when the Internet is involved this tier often involves a web service of some sort unless you want to get elbows deep writing server code.
Think about writing a RESTful api exposing your datastore to your iPhone client. I've heard good things about Open Rasta (C# REST library)
Edit - More about hosting MongoDB on the iPhone
Sorry I didn't understand that you wish to run MongoDB locally on iPhone. MongoDB is a server. I do not believe that it is embeddable as an in-process datastore. And it is not possible to run more than one process on the iPhone.
If you are familiar with C# you might want to check out MonoTouch. It allows you to run C# applications on iPhone. There is a nice library for using SqlLite which is supported by iPhone.
I'm interessted in writing an application that is running on windows mobile. I've allready a winform application that is hosting an WCF service. I wan't to port the application to windows mobile (6.0) and up. MSDN is hosting an article about WCF on Compact Framework, but it says hosting is not an option yet.
Do i have to write it all by my self over a TCP Listener?
Bye Marco
Basically, yes; you'd need to do a lot of this yourself using TcpListener. Even HttpListener isn't in Compact Framework, which is a shame (otherwise it would be easy).
There may be pre-canned solutions available, however.
For interest, I have an open-source framework that is nearly there - it has all the serialization / dispatch / etc code, but I haven't yet added raw TcpListener support, which is a shame. But maybe soon.
Couldn't you port the mono HttpListener class to the Compact Framework. At least you'd be starting with a pretty well tested code base and as baseline.