How to use feeds in Java/Scala

Added by Henrik about 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 (85)

buffet catering company Cardiff - Added by website about 1 month ago

pleasant post, stay aware of this fascinating work. It truly regards realize that this subject is being secured likewise on this site so cheers for setting aside time to talk about this! buffet catering company Cardiff

buffet catering service Belfast - Added by website about 1 month ago

Extremely helpful post. This is my first time i visit here. I discovered such a large number of intriguing stuff in your blog particularly its exchange. Truly its extraordinary article. Keep it up. buffet catering service Belfast

buffet catering company Milton Keynes - Added by website about 1 month ago

I appreciate several from the Information which has been composed, and especially the remarks posted I will visit once more. buffet catering company Milton Keynes

buffet catering company Aberdeen - Added by website about 1 month ago

Nothing compares to Weber using Genesis sort of grills. That is certainly the type gas grills which have been that will always make sure that they deliver a high performance part of down interval buffet catering company Aberdeen

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

Замечательный пост в блоге. Мы очень благодарны за ваш пост в блоге. Вы найдете много подходов,https://www.interactivemedia.az/seo-optimizasiya/ посетив свой пост. Я именно искал. Спасибо за такой пост, продолжайте в том же духе. Отличная работа

verdale showflat - Added by website about 1 month ago

Residential property prices in Singapore rose 8.8 percent year-on-year during the third ... Singaporepropertylaunch.com.sg aims to deliver latest, consolidated verdale showflat

salon somerville ma - Added by website 29 days ago

definately enjoy every little bit of it and I have you bookmarked to check out new stuff of your blog a must read blog! salon somerville ma

spring workout - Added by website 29 days ago

If you don"t mind proceed with this extraordinary work and I anticipate a greater amount of your magnificent blog entries. spring workout

online home work - Added by website 29 days ago

helphub offers online home work services for students, this helps them save time, and excel in their courses No matter what kind of essay paper and homework help you need.

low carb - Added by website 29 days ago

Thankyou for sharing the data which is beneficial for me and others likewise to see.
low carb

whippie quotes - Added by website 28 days ago

The hippie movement revered harmony with nature, communal living, artistic experimentation and drugs Here are whippie quotes about love, life and peace.

أعراض - Added by website 28 days ago

Diagnose the disease according to <a href="https://tebhayat.com/">أعراض</a> symptoms, all symptoms and signs of the disease that lead to the correct diagnosis and treatment أعراض

BBQ and Hog Roast buffet catering Rotherham - Added by website 26 days ago

Thanks for Nice and Informative Post. This article is really contains lot more information about This Topic. BBQ and Hog Roast buffet catering Rotherham

BBQ and Hog Roast buffet catering Halifax - Added by website 26 days ago

A debt of gratitude is in order for posting this information. I simply need to tell you that I simply look at your site and I discover it exceptionally fascinating and educational. I can hardly wait to peruse bunches of your posts. BBQ and Hog Roast buffet catering Halifax

BBQ and Hog Roast buffet catering Dundee - Added by website 26 days ago

Regular visits listed here are the easiest method to appreciate your energy, which is why why I am going to the website everyday, searching for new, interesting info. Many, thank you BBQ and Hog Roast buffet catering Dundee

office and corporate buffet caterers Colchester - Added by website 26 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. office and corporate buffet caterers Colchester

office and corporate buffet caterers Maidstone - Added by website 26 days ago

Regular visits listed here are the easiest method to appreciate your energy, which is why why I am going to the website everyday, searching for new, interesting info. Many, thank you office and corporate buffet caterers Maidstone

office and corporate buffet caterers Dudley - Added by website 26 days ago

I'm impressed, I must say. Very rarely do I come across a blog thats both informative and entertaining, and let me tell you, you ve hit the nail on the head. Your blog is important.. office and corporate buffet caterers Dudley

office and corporate buffet caterers Rotherham - Added by website 26 days ago

I love significantly your own post! I look at all post is great. I discovered your personal content using bing search. Discover my webpage is a great one as you.I work to create several content this post. Once more you can thank you and keep it create! Enjoy! office and corporate buffet caterers Rotherham

office and corporate buffet caterers Barnsley - Added by website 26 days ago

Extremely pleasant article, I appreciated perusing your post, exceptionally decent share, I need to twit this to my adherents. Much appreciated!. office and corporate buffet caterers Barnsley

health tips - Added by website 24 days ago

Researched based articles based on scientific evidence on healthy living Join us in discovering all health tips and secrets to live a healthy life

COVID-19 antigen rapid test - Added by website 24 days ago

The low-cost, COVID-19 antigen rapid test smartphone-based Kit to detect COVID-19

Acemyhomework - Added by website 24 days ago

Acemyhomework is the best homework help website for students Acemyhomework writers offer top assignment writing service.

Bazar Online Shopping - Added by website 23 days ago

Super Bazar Online Shopping in pakistan. Best Deals available at discounted rates. Cah on delivery Service in Karachi, Lahore, Rawalpindi, across Pakistan.

1 2 3 4 (26-50/85)