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 4 years ago.
Improve this question
I'm using Angular 4 Typescript and MySQL to create a chat system. I can post messages to my server.
But, I'm having a hard time of understanding how to retrieve the data. When a user subscribes to the chat channel, I don't want him/her to receive all the chat logs at once. Only the most recent. How would I go about this?
Firstly, you need the server to talk to the client instead of HTTP polling. HTML5 has server-sent events (SSE) but there's a much better way.
Websockets is the way forward. This way the server can broadcast new chat messages to all clients. npm's socket.io is a great websockets implementation. Moreover, if websockets is not available on the browser (think crappy browsers) it falls back to HTTP polling and failing that it has further fallbacks for really crappy browsers.
Very happily for you, the socket.io hello world app is a chat app. You can see it here and follow the simple tutorial - https://socket.io/get-started/chat/
You can integrate socket.io into Angular very easily. As events are received by the client from the server you can emit these events to an RxJS Subject and anything can subscribe to this subject.
See this Angular info on using RxJS Subjects for inter-component communication - https://angular.io/guide/component-interaction#parent-and-children-communicate-via-a-service
OK, that's the easy part done. What about getting the messages before the user joined the chat channel. Server side, you should look at message queuing. I'm not greatly experienced here but techs like RabbitMQ are what you need. That should do it but, on the client-side, I would also take a look at RxJS Replay Subjects (a different type of Subject) which can emit events that happened before subscription.
TIP: If you are really going pro you should be using a client-side Angular store such as ngrx. Free tutorials here tend to be rubbish. I would recommend investing in the ngrx tutorial on Udemy. ngrx is what the pro's use.
Related
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 1 year ago.
Improve this question
Okay. So I've built a couple of websites for people. I'm a front end developer and I've toggled with backed a bit but not much to be confident about it. I am now ready to build my portfolio but it comes in combination with my blog.
I have to options.
Static website - I don't have a lot of time. I'm on clock for certain reasons so I'm not sure of this option. However I feel as though it will be easier to add the firebase series I want. Such as firebase hosting, database, storage and authentication. Also you know how in blogs when your going through their post and you click 'next'and it pops up more blog posts. Can this be done with firebase?
WordPress - every person, even none developers have toggled with WordPress. I'm no expert in it but Im sure it will be much easier to pick up that javascript. Because of time this seems the best option but I'm confused about integration with the services I want. I know that on WordPress I can create a post and it pops it up live. I don't need to create that with firebase? Will I even need firebase database or storage? How would I work with login in and authentication?
Any advice?
If your goal is simply to build a page about yourself + blog pick the easiest CMS known which is Wordpress, in fact almost every even free template offers just that. The fastest, the simplest and the least time-consuming thing. Firebase is a nice tool rather intended for building applications with data streaming like real time application which is not your goal here. I have both firebase and wordpress projects behind me, and I'm a front end developer as well and with a clear conscience, if you only want to create a blog and your portfolio, don't worry about authentication and possible security, choose Wordpress.
However, if you approach this as a challenge and both the construction of the blog is to be a lesson to you, try one of the available starters for firebase blogs, e.g. https://github.com/NeoWu1216/firebase-blog
the idea of using firebase may seem cool but not for that purpose. Save your time and just install wordpress ;)
Wordpress and Firebase do not work well together since Firebase only serves static HTML files and cannot run server-side code. Wordpress is built on PHP which IS server-side. If you want to make a dynamic blog on Firebase you will have to find or create an app that runs the code client-side. Another option is to use a static site generator like Jekyll to create a static site and upload it to Firebase. So unless you know something that I don’t about Wordpress and its compatibility with Firebase, I think you should choose something else like Jekyll
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
I have scenario for which I am looking for a message queue service which supports below:
Ease to Use
Very high in performance
Message once read shouldn't be available for other consumers.
Should have capability to delete the message once read.
Message once published should not get dropped.
The scenario which I have is described below:
There are many publishers.
There will be many consumers.
Queuing server and consumers residing on same machine, but publishers are residing on different machines.
Please let me know best queuing service apart from Rabbitmq and sqs satisfying above points
I would recommend Apache Kafka: http://kafka.apache.org/
If you want to know a comparison between Kafka and RabbitMQ you should read this article: http://www.quora.com/RabbitMQ/RabbitMQ-vs-Kafka-which-one-for-durable-messaging-with-good-query-features
Also, you should take a look to this: ActiveMQ or RabbitMQ or ZeroMQ or
Kafka as far I know is mainly meant for real data propagation and I think my requirement doesn't require something like kafka. I have used SQS but the only problem I have with SQS is high latency. Publisher pushed message to queue and consumer keep on polling for new message, this implementation is hitting me with very high latency. My requirement is simple as follows:
Queue service should have high availability and reliability like SQS
Latency should be very high lets say not more than 10ms. (here 10ms includes publishing and receiving the message).
Also my message size is very small say not more than 20-30 bytes.
I have thought of using redis, in which I will be pushing the messages to a list and workers will keep on popping them back to back till list becomes empty, but I have not done any benchmarking on that. So here I really need suggestion so I go in right direction.
Thanks,
For some of my system integration projects I met the MQ-tasks. Several rich costumers wants the production solutions like IBM WebSphere MQ, but I think it's too much expressive and difficult.
I found and used the simple and stable analog: e-mail server.
All integrated systems got the local e-mail boxes. Messages are e-mail, with command-code in subject and json in attachments. E-mail server listen and dispatch all queues, to recipients or to groups of them. E-mail protocols are stable and all developers know a lot of tools to work with it. Sysadmins and testers use the simple e-mail clients for testing and auditing. All e-mail servers have a logging tools.
It's best and easy solution, and I suggest it for most of integration projects.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
I'd like some advice as to the best server-side code that can handle real time data from devices and make decisions based on inputs. A simple example: Suppose I have a web-enabled thermometer, running a light TCP/IP client stack. When the temperature gets to 30 degrees, I want the device to contact the server, and then I want the server to send me an email. I also want the server to be able to send a command to turn on a heater.
The issue at hand here is the ability to start a TCP message from the server, and get through an assortment of arbitrary firewalls and routers, all the way down to the client device. I know that there are 'workarounds' like polling the server for updates, or 'long polling' where I call up to the server, and keep a connection open in case it has something to send. The problem here is bandwidth. Messages are rare, but important, so the headers and handshaking make up 98% of the traffic.
I've been reading up on WebSockets, and it seems like they are exactly what I need, especially when paired with HTML5.
Does anyone know of a ready-to-go server software package that could run on a cloud server, and push data down to my devices using some standardized methods? I really don't want to reinvent the wheel here, and I can't believe I'm the first to try this. I see a few folks doing it with their own proprietary solutions, but I'm more interested in buying a one-stop package.
WebSocket is a valid choice for connecting embedded devices to backend infrastructure due to it's low overhead, low latency and compatibility with Web and general network infrastructure. There is a broad range of server implementations available, i.e. Jetty, node.js based etc.
As an example, here is a demo connecting an Arduino device to a WebSocket server and a browser client showing real-time data in a chart:
https://github.com/tavendo/AutobahnPython/tree/master/examples/wamp/serial2ws
http://www.youtube.com/watch?v=va7j86thW5M
The technology used there, AutobahnPython, is a Python/Twisted based WebSocket implementation that
provides server and client implementation
directly runs on embedded devices like RasperryPi
makes it easy to access sensors connected via serial or CANbus (since Twisted supports that very well)
provides RPC and PubSub messsaging patterns on top of WebSocket
The tech is open-source, so you can roll your own solution. If you look for help/services to get it done for you, contact me;) We also provide Tavendo WebMQ, a virtual appliance (VMware, EC2) which adds features, management UI etc and also includes a REST API to push data to WebSocket clients.
Disclaimer: I am author of Autobahn and work for Tavendo.
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
The HTML5 family of specs has several new communication capabilities, including XmlHttpRequest Level 2, Web Sockets, and Server-Sent Events. I can easily think of examples of web apps that I might like to build with these specs.
Edit: Here's some examples:
XHR2: search client, web mail, file uploader
Web Sockets: FPS, online games, chat client, NRT traffic or weather reports
SSE: Stock ticker, news feed, FB wall
But when it comes to the HTML5 Web Messaging spec, I can't think of any. So what kinds of web apps might I want to build with it? TIA.
http://www.w3.org/TR/webmessaging/
I use it to communicate between tabs. For example, when capturing an electronic signature, we open the document to be signed in a new tab. When they submit the signature, I message the main tab to let it know that the signature has been submitted. This allows me to take further actions on the main tab without having to do some convoluted server-side check via polling.
It's intended for cross-domain messaging. One big example would be Facebook apps, which currently have to communicate with Facebook via a convoluted manner as they live on a separate domain in an iframe.
I think all these technologies enable a more responsive web design. It's just like the AJAX transition: Before the transition, users expect to see the whole page refresh; After the transition, users understand the page can be updated partially.
When the new transition is finished, users will realize that content on the page could be real-time data. That means a user is not only interacting with a website (and then wait for other users to interact with the same website). He or she could be interacting with other users because it's real-time interaction over the website.
Cross-domain support will make this more widely adopted. Because not everybody will set up their own responsive web server and real-time web application, cross-domain support will allow those not-so-dynamic websites to integrate new features from 3rd-parties.
I recently found a good use case for Web Messaging. Many web apps are starting to authenticate using Facebook, so they open another tab with a Facebook login and communicate with the its contents.
Got a better use case? If so, I'll unselect my answer.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
Improve this question
I want to run a website where people could see each other through web camera. I can't find anything in google, so, can you give me any suggestions or link to tutorial?
Thanks
Action Script 3 + Flash Media Server or opensource Red5 server
http://osflash.org/red5
Would like to try something hot ?
Silverlight 4 (now in Beta) seems to have support for microphone&webcam. You will need to create server side for it as well. Probably some kind of user management and contact list. There will be significant bandwidth if you get lot of users, so the server side should created be scalable to multiple machines. Maybe Azure cloud ? With any platform you choose it will take lot of effort.
I belive that you did not undestand that this think you ask, if you going to build it its takes months of design and developing.
if you search for "web chat webcam" you maybe see why I say that.
For example this http://www.ivideochat.com/ site have developed a program for that reason. See how complicate it is, how many think have.
Also you did not say, what platform you using, what is your server that going to split the video channels and send them all over the other, are you going to use it for one to one, or all to all, are you going to build it on asp.net ? on linux, on flash, on what ?
Some times small thinks in words, are too huge in developing.
So for me you must define a lot of thinks and then maybe you can see if you can do that.
1.Media stream server ? example http://www.adobe.com/products/flashmediaserver/
2.Developing platform.
3.Number of possible users.
4.The way they goint o interact each other.
5.All of them need to have camera ?
6.What about bad users (that show bad thinks) ?
7.Do they going to chat also ?
Think about all that first, then maybe is more clear to you what you going to get.
An adsl connection 12$, a computer
320$, as3 documentacion about camera
class priceless
Architecturally, you need a server to relay the video/audio to both parties, since they cannot connect directly.
You need a Silverlight or Flash 'movie' running in the browser, which you have written, and you need a server to do the relaying.
Its relatively straightforward using Haxe.
Haxe is a Free language for creating both Flash 'movies' and server applications (and more; read their homepage).
One of the Haxe-related servers that is available for Free is HaxeVideo - literally a video server that (among other things) supports live streaming from clients. Run HaxeVideo on a server and you can easily make Flash clients (written in the Haxe language naturally) do video chat.
There are several sites that do precisely this e.g. Reel Portal and DoVisio
If you anticipate a very high volume you can turn to $$$ servers such as Wowza or Flash Media Server (FMS), or you can simply add peering support to HaxeVideo.
My suggestion is to hire a developer or two who know how to build web-applications involving real-time audio & video capabilities in Flex/Silverlight.