lichess-org / external-engine

Using engines running outside of the browser on https://lichess.org/analysis
GNU General Public License v3.0
76 stars 22 forks source link

Why use ws? #10

Closed NiclasSchwalbe closed 1 year ago

NiclasSchwalbe commented 2 years ago

Hey guys,

great that you implement external engine use! I wished that for lichess just yesterday. I wanted to ask why a ws is necessary, should not just a regular rest-adapter (in form of a additional layer before UCI) have done the job?

Greetings, Niclas

niklasf commented 2 years ago

Hi Niclas, sure, currently revisiting this choice. Isn't WS pretty standard for bidirectional communicaton, though?

NiclasSchwalbe commented 2 years ago

I rethought.

So basically, both - the engine and the lichess client - are on the the local machine. In this case I think a ws might be unnecessary.

(For Linux & Mac) I would just make a small program (adapter) which talks to stockfish. This small program creates a plain old socket on the local machine. Then you bind your browser to this socket. The adapter then just makes connection to Stockfish and just redirects all messages.

I think on Windows this should be quite similar.

Do you want me to try? I could make a small proof of concept.

Viele Grüße Niclas Schwalbe +4915901115005


Von: Niklas Fiekas @.> Gesendet: Saturday, September 3, 2022 9:38:57 PM An: lichess-org/external-engine @.> Cc: Niclas Schwalbe @.>; Author @.> Betreff: Re: [lichess-org/external-engine] Why use ws? (Issue #10)

Hi Niclas, sure, currently revisiting this choice. Isn't WS pretty standard for bidirectional communicaton, though?

— Reply to this email directly, view it on GitHubhttps://github.com/lichess-org/external-engine/issues/10#issuecomment-1236187757, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AHDVHW2AKS4HXWPHOIQRLC3V4OSNDANCNFSM55RJBSJQ. You are receiving this because you authored the thread.Message ID: @.***>

benediktwerner commented 2 years ago

How would you create or bind to a socket from the Lichess website? Just because the Lichess client also runs on the local machine doesn't mean it can just do anything. It's still constrained to what the browser allows.

Also, it's not given that the engine will run on the local machine. The current protocol also allows connecting to a remote engine, e.g. on a strong server.

NiclasSchwalbe commented 1 year ago

I think the browser would allow it. But ofc when you want to bind to a strong server too (which I was not aware of), ws might be the right technology.

Viele Grüße Niclas Schwalbe +4915901115005


Von: Benedikt Werner @.> Gesendet: Sunday, September 4, 2022 10:05:31 AM An: lichess-org/external-engine @.> Cc: Niclas Schwalbe @.>; Author @.> Betreff: Re: [lichess-org/external-engine] Why use ws? (Issue #10)

How would you create or bind to a socket from the Lichess website? Just because the Lichess "client" also runs on the local machine doesn't mean it can just do anything. It's still constrained to what the browser allows.

Also, it's not given that the engine will run on the local machine. The current protocol also allows connecting to a remote engine, e.g. on a strong server.

— Reply to this email directly, view it on GitHubhttps://github.com/lichess-org/external-engine/issues/10#issuecomment-1236284338, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AHDVHW33S6SKPGCSY6FD62LV4RJ4XANCNFSM55RJBSJQ. You are receiving this because you authored the thread.Message ID: @.***>

niklasf commented 1 year ago

New API draft uses plain HTTP: http://127.0.0.1:8089/#tag/External-engine-(draft).