I am doing an app which renders a web page in an upnp enabled television set. I have implemented the UPnP with Cling UPnP
Now I am not sure how to proceed further. How is the connection between the Television and the device attained? Is it a socket connection? has anybody got any samples or tutorials regarding this topic which help me to implement UPnP streaming.
I have searched on google but it mainly points to existing apps available in google play.
Thanks
Ok, so the service descriptor xml (SCPD) contains <actionList> of <action>s with their parameters, which can be in (to the TV) or out (will be in the TV's response to the action). You need to "call" the action, which means that Cling serializes it to SOAP RPC and sends it to the device as HTTP request. In the response, you will get the overall result of the call as with plain HTTP, 200 for OK, 500 for Bad Request, etc. Each code has a specific explanation in context of the particular action call. The response will also hold out parameters as specified in the SCPD.
But this all is not as much of your interest when using an abstraction library like Cling. It will do everything for you. Disclaimer: i am not familiar with Cling, just with enough other UPnP libs to know where to look for things.
As a TV set, the 3 services you mention will be undoubtely AVTransport,ConnectionManager and RenderingControl. So to present a simple example which will actually do something observable on the TV, let's call RenderingControl.SetVolume. The method you need is org.teleal.cling.support.renderingcontrol.callback.SetVolume. I can't help you to the level of knowing where to obtain the Service parameter, but you should be able to figure out.
I am not saying that you don't need to know how UPnP works under the hood. Grabbing the UPnP specs bundle and reading at least the DeviceArchitecture pdf is indispensable. And you will definitely need the specs to understand the more complicated services like AVTransport. Hint: don't care about InstanceID and ConnectionID. It's all 0 unless you connect to a very advanced renderer (which the TVs nowadays are not).
Related
I need to create an app which get's it's displayed data from FIX protocol in real time.
How would be best practice to accomplish this?
Should the mobile app read directly the FIX data?
Should I put a server in between to transform the FIX data to JSON or something more prepared for service consumption? And if so... how would I do it to not lose the real time? Creating a websocket in Java which for the mobile apps to call and that websocket would transform the FIX data to JSON that way?
I never worked with the FIX protocol before by the way.
So like, the question is, can you put a FIX client on a mobile phone? I guess you can, and I am sure it will happen soon.
Yes, anything can read FIX data, it's simply text stream name value pairs, where the name is a numbered tag to identify some particular financial data or process, as agreed between the FIX community as a whole, or between direct counterparties using messaging data dictionaries.
These days you could try using SBE throughout, including at the mobile client, but for now current practise is yes, to use JSON for client endpoints (where the JSON name is not a FIX tag but the underlying FIX field name so it's easier for people to understand) and pass JSON messages to the mobile device in some kind of REST data processing.
So yeah, you'd have a FIX server (if you are new to FIX try QuickFix) to connect with your provider. Then what you need between that server and mobile clients is asynchronous messaging. Consider a quote request is not a simple request / response where you can block the request thread until a single response is received, it's a request followed by a stream of many responses. So you want an event handler style to route the responses back to clients asynchronously. With many mobile UI clients making requests and receiving responses you need to demultiplex the responses from the 1 FIX server out to the many mobile clients. That's something that QuickFIX itself kind of already does using a session layer. You need to do the same using sessions or identifiers in the messages you're passing around.
Yeah I guess websockets are intended to be that solution for real time. You could write a native mobile app though, using something like node or react to handle the message events.
Let's say I've created a mobile application named 'Foo'(iOS). This app talks to a Java-running backend at 'java.com' and works perfectly. Now, I'm trying to create the website 'Foo.com' to let users enjoy the 'same' service on a browser/computer. So far, I've found that almost all calls needed to the API from the website can be done in JavaScript directly to the backend at 'java.com', including a login-function.
On the backend, I've implemented the standard 'doPost'-method to handle the login, and I create a Cookie to attach to the request.
The problem, I think, is that the users get the JavaScript from 'Foo.com', and the JavaScript tries to log in by using an AJAX-call to 'java.com', thus the cookie will be 'stamped' by www.java.com', not by 'www.foo.com', and the user will never receive the cookie. (At least, I don't receive a cookie now)
I've been trying to find a way to accept cookies from 'api.com' into the application, but it doesn't look good. Honestly, I'm not even sure this is the actual problem causing me to not receive a cookie, but I've read several places that cross-domain-cookies aren't allowed. So I ask the general question, how should I proceed?
I've been toying with the idea to add a .php-page to the server-side of the website 'foo.com', and from there handle the requests from client to API, hopefully causing the cookies to be 'stamped' as 'foo.com' instead of 'java.com'. (In that case, I'd also wonder if the .php can forward the information in the cookie or something similar).
But I really want to avoid as much traffic on the webhost as possible. An all-script-website would be optimal, but I don't really see how cookies can work with that.
Is there anything else I can do to handle this? If I simply want a persistent login-function from a client of 'foo.com' handled at 'java.com', are there any options, with or without the use of cookies?
i would like to know how the update messages in this stack overflow site have been implemented.
To be more precise, for example while i am trying to reply for question and i am in the middle of typing my response, i will see a message on top of the page saying a new answer has been added. How is this feature has been implemented.
AFAIK, the possible way can be HTML5 websocket or serversocket technology.
is there any other way to achieve this kind of push notification system especially using java, spring and jquery environment?
Not sure how to tag this question. correct the tags if i am wrong.
SO uses reverse ajax/comet technology to show those messages. I remember reading some discussion on meta about this feature, couldn't exactly find out the link for it at this moment. Will update as soon as I find.
Based on programming language framework name may change (websockets (or) socket.io etc.,), but at the end they all are from comet framework.
Update:
Here is SO meta discussion on this topic.
I have used the Direct Web Remoting framework with success. (DWR).
There are several ways to achieve that:
Polling: using JQuery you issue a request regularly (every 5sec for examples) which retrieves the updates from the server.
Streaming: you issue a request, the server does not set a Content-Length to the response and "never" close the socket. This way you can send data from server to client whenever you want. But it means that for every client a connection is hold by your server.
Long polling: mix between the two previous ways. The connection is hold by the server but with a timeout. If no new data is available, the server closes the connection and the client reopen a new one after a moment.
Thoses are Push technologies: http://en.wikipedia.org/wiki/Push_technology
Of course there are over ways to achieve that.
I am running a webapp on Apache Tomcat. I want my app to send out an email to the users, for certain actions. I have tried using Java Mail, but I am not happy with performance.
I would like to use an external service for the same. I came across MailChimp, but realized, it doesn't suit my requirements, as I want to send the mail IMMEDIATELY, rather than later, as a part of a campaign. I want something that will let me send a mail to an id, IMMEDIATELY.
Can anyone here, suggest any service, for this? Any reviews/past experiences? Will be very appreciated.
Cheers,
RD
Edit :
Thanks all for the suggestions. But I don't want to continue with my code for sending out emails. I have noticed issues with my email id getting blocked, infrequent delays of upto 3 hours before delivery of email etc. I want to use a webservice, which helps me send out mails. That is what, my question is.
Solution :
Thanks to all the help from the people here, mostly to JonLim, I zeroed in on PostageApp and PostmarkApp. However, finally settled on Postmark, because they seemed to have an easier Java client! I blogged a post on how I configured and integrated my webapp here.
You have plenty of email service providers at your disposal:
PostageApp (Ours!)
SendGrid
PostmarkApp
Amazon SES
Figure out which one suits your needs and take your pick!
(Full Disclosure: I am the Product Manager of PostageApp.)
The only issue with the java mail API is that it's not very developer-friendly. For that purpose there is commons-email. As for performance - its performance is fine - it just creates a raw SMTP request to the SMTP server. So the problem must be either in your code or in your SMTP server.
I think the first thing you should find out the source of the slowness (profiling your application). That will help determine how to improve it.
That being said, you should definitely take a look at your MTA configuration. I use postfix and it's fast, secure, and easy to configure and maintain.
I a deveveloping a web site that comunicates with a custom made webserver by me in Java. The web site is made in PHP/JavaScript/JQuery running on Apache and i made a simple second webserver in Java to support some designed features by me, and this server runs under another port XXXXX. The problem is, i want to make requests in jQuery to second server the domain is diferent, the page runs on domain and the $.getJSON function calls domain:XXXXX wich is not allowed. I thought user $.getJSONP but im concerning concerned issues. The connections between two points is authed (i was think by passing a token beyond the callback generated by jquery). The two poins are supported by. Is there safe in this case use $.getJSONP or exists other alternatives thinking in browsers support(IE7+ and FF3+).
Sorry for my english :)
Best regards lealoureiro
JSONP should work for your needs, however your other option would be to have a proxy service on your second server that would make the request server side. Your client-side code could then access all the data natively via json instead of jsonp.