Skip to content
This repository has been archived by the owner on May 7, 2020. It is now read-only.

Commit

Permalink
Bosesoundtouch - fixed an issue with async. websocket requests (#6874)
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Kostadinov <alexander.g.kostadinov@gmail.com>
  • Loading branch information
alex-kostadinov authored and kaikreuzer committed Jan 24, 2019
1 parent 2239635 commit 1f60913
Showing 1 changed file with 4 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

import static org.eclipse.smarthome.binding.bosesoundtouch.BoseSoundTouchBindingConstants.*;

import java.io.IOException;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
Expand Down Expand Up @@ -119,12 +118,8 @@ public void addCurrentContentItemToPresetContainer(DecimalType command) {
public void getInformations(APIRequest apiRequest) {
String msg = "<msg><header " + "deviceID=\"" + handler.getMacAddress() + "\"" + " url=\"" + apiRequest
+ "\" method=\"GET\"><request requestID=\"0\"><info type=\"new\"/></request></header></msg>";
try {
handler.getSession().getRemote().sendString(msg);
logger.debug("{}: sending request: {}", handler.getDeviceName(), msg);
} catch (IOException e) {
handler.onWebSocketError(e);
}
handler.getSession().getRemote().sendStringByFuture(msg);
logger.debug("{}: sending request: {}", handler.getDeviceName(), msg);
}

/**
Expand Down Expand Up @@ -380,9 +375,9 @@ private void sendPostRequestInWebSocket(String url, String infoAddon, String pos
+ "\" method=\"POST\"><request requestID=\"" + id + "\"><info " + infoAddon
+ " type=\"new\"/></request></header><body>" + postData + "</body></msg>";
try {
handler.getSession().getRemote().sendString(msg);
handler.getSession().getRemote().sendStringByFuture(msg);
logger.debug("{}: sending request: {}", handler.getDeviceName(), msg);
} catch (IOException | NullPointerException e) {
} catch (NullPointerException e) {
handler.onWebSocketError(e);
}
}
Expand Down

0 comments on commit 1f60913

Please sign in to comment.