Skip to content

ngohuusang/java-unity-websocket-connector

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

java-unity-websocket-connector

The purpose of this project is to prototype out connecting a Unity3d project to a backend Java server via websockets. It is licensed under the Apache License, Version 2.0 (the "License")

Note: This uses the websocket-sharp library found here: https://github.com/sta/websocket-sharp

  • This is used as a compiled dll at unity-client/Assets/websocket-sharp.dll but it may need to be recompiled on your system.

The backend Java server is a maven-built project on Java 8.0. It can be run with mvn clean jetty:run It is currently set to run on port 11037. It uses Spring Security to authenticate connecting clients. The frontend runs on Unity3d version 5.5.0f3.

Currently a user is able to start the Unity program; enter in the server ip, username, and password; and log in. If it successfully connects to the backend server, it will request the user's friendslist from the server, and display it when received.

Note: User information can be found hardcoded in unity-websocket-server/src/main/java/com/logiclodge/unitywebsocketserver/user/UserDao.java

This has been tested (and works) on the following Unity platforms

  • Windows
  • Android

TODO list:

  • Implement 'ADDFRIEND' request/response
  • Unit Testing
  • Propper error handling both clientside and serverside.
  • Figure out a way to tell that the username/password is incorrect clientside (currently just fails with a network error)

DISCLAIMER: I am a Java programmer so some of the Unity C# techniques may seem odd.

About

Connecting a Unity client with a back-end Java server via websockets

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 76.6%
  • C# 23.4%