1
1
mirror of https://github.com/ahabhyde/miguelbridge synced 2025-01-10 06:24:20 +01:00

First version with 5000 timeout long poll request

This commit is contained in:
Ahab Hyde 2018-10-13 23:35:36 +02:00
parent 8a9ffaba48
commit c657f6a022
3 changed files with 4 additions and 4 deletions

View File

@ -65,7 +65,7 @@ public class Launcher {
while (true) { while (true) {
//Main loop del bot di matrix //Main loop del bot di matrix
Thread.sleep(sleepTime); //Thread.sleep(sleepTime);
rooms = getRooms(); rooms = getRooms();
for (int roomNumber=0; roomNumber<rooms.size(); roomNumber++) { for (int roomNumber=0; roomNumber<rooms.size(); roomNumber++) {
JSONObject room = (JSONObject) rooms.get(roomNumber); JSONObject room = (JSONObject) rooms.get(roomNumber);

View File

@ -240,7 +240,7 @@ public class MatrixBot {
try { try {
String filtro = URLEncoder.encode("{\"room\":{\"timeline\":{\"limit\":1}}}", "UTF-8"); String filtro = URLEncoder.encode("{\"room\":{\"timeline\":{\"limit\":1}}}", "UTF-8");
String requestUrl = homeUrl + String requestUrl = homeUrl +
String.format("client/r0/sync?filter=%s&access_token=%s", String.format("client/r0/sync?filter=%s&timeout=5000&access_token=%s",
filtro, accessToken); filtro, accessToken);
String[] risposta = RequestHandler.getRequest(requestUrl); String[] risposta = RequestHandler.getRequest(requestUrl);

View File

@ -1,4 +1,4 @@
package test; \package test;
import com.em.miguelbridge.botmatrix.MatrixBot; import com.em.miguelbridge.botmatrix.MatrixBot;
import org.json.simple.parser.ParseException; import org.json.simple.parser.ParseException;
@ -47,6 +47,6 @@ public class UploadTest {
File file = new File("prova.jpg"); File file = new File("prova.jpg");
//bot.sendMessage("provaa", "!mPkXwqjuGdhEVSopiG:maxwell.ydns.eu"); //bot.sendMessage("provaa", "!mPkXwqjuGdhEVSopiG:maxwell.ydns.eu");
System.out.println(bot.sendFile("!mPkXwqjuGdhEVSopiG:maxwell.ydns.eu", file, null, true)); //System.out.println(bot.sendFile("!mPkXwqjuGdhEVSopiG:maxwell.ydns.eu", file, null, true));
} }
} }