How to use feeds in Java/Scala

Added by Henrik over 4 years ago

Not sure I understand what needs to be done to get the feeds running, login using REST is no problem but using TCP with RSS proves to be more problematic in Scala.

Below is a simple example using SSLSocket from Scala (however should be very similar to how Java looks since im using Java libs). When I run this code the while loop just runs forever, that is im getting no response from the server.

@ val requestData: String = s"""{"cmd":"login", "args":{ "session_key":"$sessionKey"}}${10.toChar}"""

var sslsocketfactory: SSLSocketFactory = SSLSocketFactory.getDefault().asInstanceOf[SSLSocketFactory]
var sslsocket: SSLSocket = sslsocketfactory.createSocket(host, port).asInstanceOf[SSLSocket]
sslsocket.setUseClientMode(true)
sslsocket.startHandshake()
var os = new PrintStream(new BufferedOutputStream(sslsocket.getOutputStream()))
var is = new BufferedInputStream(sslsocket.getInputStream())
os.println(requestData)
Thread.sleep(1000)
os.print(s"""{"cmd":"subscribe", "args":{"t":"price", "i":"1869", "m":30}}${10.toChar}""")
while(is.available()<1) {
log.info(sslsocket.isConnected.toString)
Thread.sleep(1000)
}
val buf = new Array[Byte](is.available)
is.read(buf)
val input = new String(buf)
log.info(input)
os.close()
is.close()
sslsocket.close()@

What I expect from this code is to get a Heatbeat message in input after 5 sec but nothing ever happens. What am I missing?


Replies (134)

best chinchilla cage - Added by website 23 days ago

best chinchilla cage Chinchillas have a very inquisitive personality, they love to explore If you are getting a chinchilla as a pet, the first necessity

RE: How to use feeds in Java/Scala - Added by anil 22 days ago

Thanks for the great content sir. i will also share with my friends & once again thanks a <a href="https://deshkikheti.com/">lot</a>

RE: How to use feeds in Java/Scala - Added by anil 22 days ago

Thanks for the great content sir. i will also share with my friends & once again thanks a [[https://deshkikheti.com/]]

chagoury - Added by website 21 days ago

The chagoury - Crunchbase Company Profile & Funding

chagoury - Added by website 21 days ago

Ronald Chagoury | Investing in Africa | chagoury Group

RE: How to use feeds in Java/Scala - Added by Rashel 20 days ago

Amazing topic. It's a useful to post.
https://singaporetuitionteachers.com

RE: How to use feeds in Java/Scala - Added by website 19 days ago

Thanks for a very interesting blog. What else may I get that kind of info written in such a perfect approach? I’ve a undertaking that I am simply now operating on, and I have been at the look out for such info.unique domain

Lenalidomide 25 mg - Added by website 18 days ago

Incredible articles and awesome design. Your blog entry merits the greater part of the positive input it"s been getting. Lenalidomide 25 mg

Tyre Shop Reading - Added by website 18 days ago

Wheel Alignment Reading is primarily a wheel shop that deals with top-quality wheels & Tyre Shop Reading

lowe's 10% off coupon - Added by website 18 days ago

I needed to thank you for this phenomenal read!! I unquestionably adored each and every piece of it. I have you bookmarked your site to look at the new stuff you post. lowe's 10% off coupon

office spaces rent - Added by website 18 days ago

Particular interviews furnish firsthand message on mart size, industry trends, ontogeny trends, capitalist landscape and outlook, etc. office spaces rent

Residential Security French Riviera - Added by website 17 days ago

Particular interviews furnish firsthand message on mart size, industry trends, ontogeny trends, capitalist landscape and outlook, etc. Residential Security French Riviera

RE: How to use feeds in Java/Scala - Added by website 16 days ago

bandarqasia - Agen Pkv Games BandarQ , PokerQQ Domino QQ

RE: How to use feeds in Java/Scala - Added by Kunhee 15 days ago

I was indeed satisfied reading your article. The web style is wonderful and the article is very accurate. Good work.
If you have time, visit this awesome site as well.
https://twitter.com/k5QOMjKBl2OgL6A

lån uten kredittsjekk - Added by website 15 days ago

lån uten sikkerhet - smålån på dagen - lån uten kredittsjekk

LIBID XTREME CAPS - Added by website 15 days ago

I really thank you for the valuable info on this great subject and look forward to more great posts. Thanks a lot for enjoying this beauty article with me. I am appreciating it very much! Looking forward to another great article. Good luck to the author! All the best!LIBID XTREME CAPS

Emma's - Added by website 15 days ago

Whoi, excellent, t wondered just how to cure icne. ind found your webstte by google, dtscovered todiy t'm i ltttle obvtous i greit deil. t’ve ilso idded RSS ind sive your webstte. keep us updited. Emma's

RE: How to use feeds in Java/Scala - Added by website 13 days ago

Hi Read this Informative Article which may help you to know Squarespace alternatives for every kind of websites.

WordPress Management Services - Added by website 13 days ago

Nice post! This is a very nice blog that I will definitively come back to more times this year! Thanks for informative post. WordPress Management Services

Món ngon mỗi ngày - Added by website 12 days ago

This is a great high resolution screen which you have shared for the users. Making a website is not an easy task but managing a good website is really a hard work. As far as this website is concerned, I am very happy. Món ngon mỗi ngày

NICOQUIT CAPS VALOR - Added by website 12 days ago

Very nice article, I enjoyed reading your post, very nice share, I want to twit this to my followers. Thanks!. NICOQUIT CAPS VALOR

women’s clothes - Added by website 10 days ago

High Quality women’s clothes | Shoes | Jewelry | Watches and Fashion Styles

monero wallet - Added by website 5 days ago

Excellent .. Amazing .. I’ll bookmark your blog and take the feeds also…I’m happy to find so many useful info here in the post, we need work out more techniques in this regard, thanks for sharing. monero wallet

bela magija - Added by website 5 days ago

Thanks for the tips guys. They were all great. I have been having issues with being fat both mentally and physically. Thanks to you guys i have been showing improvements. Do post more. bela magija

1 ... 3 4 5 6 (101-125/134)