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)

bilingual children - Added by website about 1 month ago

Mammaprada is a bilingual parenting blog that offers language learning resources for bilingual children and mixed culture families

soi cau 3 cang - Added by website about 1 month ago

Extremely pleasant article, I appreciated perusing your post, exceptionally decent share, I need to twit this to my adherents. Much appreciated!.  soi cau 3 cang

catsinheart - Added by website about 1 month ago

Catsinheart is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com. catsinheart

prtya - Added by website about 1 month ago

Women's Fashion Clothes , Shoes , Jewelry , Watches Prtya Online Store Shopping EVERYTHING A WOMAN NEEDS. prtya

residual income - Added by website about 1 month ago

residual income Join us on our LIVE WORKSHOPS EVERY DAY and discover how to profit online with our 100 Done For You Fully Automated Profit System

create Worpdress blog - Added by website about 1 month ago

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

70trades - Added by website about 1 month ago

Today I want take a look into 70 Trades India and help you understand why it can be a good choice if you’re in India and want to start trading. Let’s get started! 70trades

RE: How to use feeds in Java/Scala - Added by website about 1 month ago

Welcome to the story of love for the latest Turkish series and drama, through the story of love, you can follow everything new in the world of Turkish dramaموقع قصة عشق

girly quotes - Added by website about 1 month ago

Persons appreciate shopping for amazing, appealing, fascinating and from time to time attractive aromas for them selves and pertaining to others. This can be executed conveniently along with inexpensively in an on-line perfume shop. girly quotes

lô xiên 3 - Added by website about 1 month ago

This article is an engaging abundance of enlightening information that is intriguing and elegantly composed. I praise your diligent work on this and thank you for this data. You have what it takes to get consideration. lô xiên 3

Sell your car in Dubai - Added by website about 1 month ago

We offer special deals on used cars and have a large collection of used cars for sale. Unlike other used car dealers, we understand that in the used cars segment how important the condition of the used car is. Sell your car in Dubai

Property listing management - Added by website about 1 month ago

Realestatecrm.io is the perfect cloud software for Property listing management, be more efficient close more deals.

damp proofing - Added by website 30 days ago

Specialist Rising Damp Company | damp proofing

free online learning - Added by website 29 days ago

Get free online learning from skolo online learn programming, learn advance courses.

Organic Tea - Added by website 29 days ago

Buy Organic Tea or Weight Loss Herbal Tea from the best oranic Tea Brand

n95 - Added by website 28 days ago

Protect Yourself From All Viruses BUY CORONA FACE MASK CHECK OUR PRODUCTS FOR CORONA PROTECTION n95

NewMexicocreditrepair - Added by website 28 days ago

I think this is one of the most significant information for me. And i’m glad reading your article. But should remark on some general things, NewMexicocreditrepair

remote database management - Added by website 27 days ago

Abtech Technologies provides remote database management services to business of all sizes Contact us today for a quote 800 474 7397

DRM - Added by website 27 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. DRM

magicien antibes - Added by website 27 days ago

Stars Magic is a booking portal for professional mentalist magicians. Are you looking for an illusionist for your event? Our platform puts you in touch with an illusionist near you to make your company evening, your cocktail party, your product launch, your Christmas tree, your wedding or your birthday. On our site you will also find out how to learn magic with an online magic school.magicien antibes

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

Pretty good post. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I'll be subscribing to your feed and I hope you post again soon. Big thanks for the useful info.The Best Skincare Product Recommendations

Agen SBOBET - Added by website 26 days ago

Wonderful blog! I found it while surfing around on Yahoo News. Do you have any suggestions on how to get listed in Yahoo News? I’ve been trying for a while but I never seem to get there! Appreciate it.Agen SBOBET

كازينو - Added by website 25 days ago

أفضل العاب "كازينو:https://arabicliveroulette.com/" باللغة العربية | ١٠٠٪ آمن ومضمونالعربية لايف روليت

One piece manga online - Added by website 24 days ago

One piece manga online, Read One Piece Manga For Free with Fun!!

Breaking News - Added by website 24 days ago

Breaking News stories and latest news about politics, lifestyle, fashion, beauty, health, family, celebrity, Travel, and tech

1 2 3 4 5 6 (76-100/134)