我使用
eclipse MQTT连接到MQTT服务器.
我可以成功连接到服务器但是当我发布消息时,我收到了这个错误
Connection lost
msg : Connection lost
loc : Connection lost
cause : java.io.EOFException
excep : Connection lost (32109) – java.io.EOFException
我搜索了这个问题.但我找不到任何真正的答案!我在这里建立的一些链接{here,here,here,…}
我的代码:
private final String DEFAULT_HOST = "edge-mqtt.facebook.com";
private final int DEFAULT_PORT = 443;
public void connect(String protogle) throws Exception {
this.broker = protogle + "://"+ DEFAULT_HOST + ":" + DEFAULT_PORT;
this.mqttClient = new MqttClient(broker,getMqttClientId() ,new MemoryPersistence() );
MqttConnectOptions connOpts = new MqttConnectOptions();
connOpts.setCleanSession(true);
connOpts.setKeepAliveInterval( MQTT_KEEPALIVE);
connOpts.setUser