我正在使用 https://github.com/streamdataio/eventsource-android/的 EventSource REPO 并创建了一个 onConnect (); 方法,然而, eventsource.connect();method 带有红色下划线并说我无法访问它,因为它是私有的?我在网上查看,每个人都使用这个 REPO 没有问题,这里发生了什么?
private void connect() {
// Create headers: Add the streamdata.io app token
Map<String, String> headers = new HashMap<String, String>();
headers.put("X-Sd-Token", streamdataioAppToken);
// Create the EventSource with API URL & Streamdata.io authentication token
try {
eventSource = new EventSource(new URI(streamdataioProxyPrefix), new URI(myApiUrl), new SSEHandler(), headers);
} catch (URISyntaxException e) {
e.printStackTrace();
}
// Start data receiving
eventSource.connect();
}