JnCrMx / discord-game-sdk4j

Java bindings for Discord's Game SDK
MIT License
114 stars 23 forks source link

Improved java channel setup #61

Closed letorbi closed 1 year ago

letorbi commented 1 year ago

This is a new pull request with almost the same changes as PR #59. The only thing missing is the commit that disabled JavaDoc in the JitPack config, which is now part of PR #62.

Below is the original description. See the PR #59 for comments.

This PR improves the setup process of the communication channel between the library and the Discord client:

1.) The path of the Unix domain socket file is not hard-coded anymore, but derived from the available environment variables.

2.) Under Windows a named pipe instead of a socket is used now. This finally brings us Windows support confetti_ball

3.) A generic DiscordChannel interface has been introduced to handle the different ways of connecting to the Discord client. The actual implementations WindowsDiscordChannel and UnixDiscordChannel are mainly wrappers around FileChannel respectively SocketChannel.

The UDS file paths and the name of the Windows pipe have been taken from the Rust discord-sdk project. Or to be more specific from file /blob/main/sdk/src/io.rs line 128 to 212.

The code has been tested with Windows 10 and Arch Linux. No tests on MacOS yet, but chances are good, that it will work there as well. Testing on MacOS was successful, too.

Mindstyler commented 1 year ago

I'm really hoping this gets merged soon.

JnCrMx commented 1 year ago

Alright, finally got to testing and reviewing it! :D Sorry for the long delay!

letorbi commented 1 year ago

Awesome, thank you :)