urish/firebase-server

Unable to establish a connection using Firebase Admin Java SDK

dmytro-grankin opened this issue · 4 comments

The Problem

I cannot connect to firebase-server 1.0.0-rc.2 using Firebase Admin Java SDK v6.3.0 (it uses web sockets).

The Configuration

The server is starting with the firebase-server --port 54897 --rules ./firebase-rules.json --verbose command.

The Java configuration (see the SDK doc for the details):

new FirebaseOptions.Builder()
    .setDatabaseUrl("https://localhost:54897/")
    .setCredentials(credentialsFromJsonServiceAccount)
    .build()

The Expected Behavior

When I am connecting to a real Firebase server, a WebSocket frame is coming from the server. The value of the frame is {"t":"c","d":{"t":"h","d":{"ts":1533570139211,"v":"5","h":"s-usc1c-nss-233.firebaseio.com","s":"xGRmX0CTTlTNVqc7bh1P4G5vT4T065S1"}}}. After this, the SDK establishes a connection.

When I am connecting to firebase-server, such a frame is not coming. So, firebase-server should send the same frame on an attempt to establish a web socket connection with https://localhost:54897.

While hard-coding of such a response is not the best solution, firebase-server can provide configuration options. These options can specify that the response A should come after the request B. In this way, it may be useful for other client libraries, not only for the Firebase Admin Java SDK.

Hello! Is there any workaround to connect using the java admin API?

@urish I'm ready to fix the bug, could you assist me to get into the code. Thanks

urish commented

@mohammedi-haroune thanks, I'm in vacation until mid-April. Will try to help you when I get back.

urish commented

Closing, as the project has been deprecated. See #150 for details.