Comments (13)
Here is the link to the Events
class in the jetclient side which has LOG_IN
event. Mostly you will find all event related stuff in the event package.
In one way jetclient having similar class as jetserver is misleading. I should actually have a common project which both jetclient and jetserver can use. But I created jetclient project so that it has minimum jar dependencies and size at client side.
from java-game-server.
Sorry, I do not understand how it would help me.
ChannelBuffer buffer = ChannelBuffers.wrappedBuffer(opCode, NettyUtils.writeStrings(refKey, userId, accessToken, firstName, lastName));
On LOG_IN attempt I send 5 parameters to the server. Server has to parse this message and accept or reject the client. Now reject is not possible since the server always accepts every client. And LOG_IN handler is implemented inside the library.
from java-game-server.
Sorry for closing issue, tried to reopen it and could not...:( I will look into and answer.
from java-game-server.
The LoginHandler has the following code
public Player lookupPlayer(final ChannelBuffer buffer, final Channel channel) { Credentials credentials = new SimpleCredentials(buffer); Player player = lookupService.playerLookup(credentials); if(null == player){ LOG.error("Invalid credentials provided by user: {}",credentials); } return player; } public void handleLogin(Player player,Channel channel) { if (null != player) { channel.write(NettyUtils .createBufferForOpcode(Events.LOG_IN_SUCCESS)); } else { // Write future and close channel closeChannelWithLoginFailure(channel); } }
So if you return a null from the lookup service its going to invalidate the player and close the connection. In the ZombieSpringConfig class you can see the LookupService
being injected. Please use your own implementation here, the default SimpleLookupService does not care for credentials.
from java-game-server.
This is the message I have written before you last comment but did not post solving some other issue.
"No problem, you help me a lot!
I guess these lines of code are important to this task from LoginHandler.java
public Player lookupPlayer(final ChannelBuffer buffer, final Channel channel)
{
Credentials credentials = new SimpleCredentials(buffer);
Player player = lookupService.playerLookup(credentials);
I need to override lookupService.playerLookup to return null if authorization fails.
BUT, I think it is much better to have this function
public abstract Player playerLookup(final ChannelBuffer buffer);
NOT
public abstract Player playerLookup(Credentials loginDetail);
so I will be able to parse ChannelBuffer by myself and not being stuck to SimpleCredentials."
from java-game-server.
So my advice is to add following method
public abstract Player playerLookup(final ChannelBuffer buffer)
My application would be authenticated with social network and client would submit 3 parameters to the server.
- social network id (facebook, vkontakte, twitter)
- user id
- access_token
Of course, I can combine 1) and 2) in one String and then parse it to make it work with currently library build.
from java-game-server.
Credentials ,interface was very simplistic hence you are running into this problem. Passing ChannelBuffer to a service is not a great idea, first of all it leaks and second the new netty version Netty 4
changes this and other interfaces drastically, so when jetserver updates to new version it will end up breaking the service interface also. It will be good if you can stick to overriding the lookupservice for the moment. I will log a feature request for revamping the credentials interface from the very simplistic one we have now.
from java-game-server.
Yes, this makes sense.
I will combine 1) and 2) in one string them.
from java-game-server.
In here why player is not used to create a playerSession?
public void handleGameRoomJoin(Player player, Channel channel, ChannelBuffer buffer)
{
String refKey = NettyUtils.readString(buffer);
GameRoom gameRoom = lookupService.gameRoomLookup(refKey);
if(null != gameRoom)
{
PlayerSession playerSession = gameRoom.createPlayerSession();
from java-game-server.
I have added an issue for this. I will update and provide code.
from java-game-server.
I have committed the change for this. Binaries are NOT updated, please build and use latest jetserver jar file.
from java-game-server.
I have imported the jetserver folder to Eclipse.
And these are two major types of errors I am getting.
Description Resource Path Location Type
ArtifactDescriptorException: Failed to read artifact descriptor for cglib:cglib-nodep:jar:2.1_3: ArtifactResolutionException: Failure to transfer cglib:cglib-nodep:pom:2.1_3 from http://repo1.maven.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact cglib:cglib-nodep:pom:2.1_3 from/to central (http://repo1.maven.org/maven2): Connect times out pom.xml /jetserver line 1 Maven Dependency Problem
Description Resource Path Location Type
Project 'jetserver' is missing required library: 'C:\Users\Nikolay\.m2\repository\backport-util-concurrent\backport-util-concurrent\3.1\backport-util-concurrent-3.1.jar' jetserver Build path Build Path Problem
from java-game-server.
Was able to solve it using
http://stackoverflow.com/questions/2061094/importing-maven-project-into-eclipse
http://stackoverflow.com/questions/5074063/maven-problem-failure-to-transfer
http://stackoverflow.com/questions/7737710/maven-plugin-not-using-eclipses-proxy-settings
from java-game-server.
Related Issues (20)
- Add new object based protocol HOT 1
- Leak exception in NettyObjectDecoder
- Add messagepack protocol to support http://msgpack.org/
- Fix flash client compatibility to nadron
- LengthFieldBasedFrameDecoder fix
- Add "Lobby" functionality to nadron HOT 1
- Flash client does not receive START event when using AMF3 protocol. HOT 3
- update to netty5 HOT 2
- the Custom MessageDecode HOT 1
- The io.netty.buffer.EmptyByteBuf issue HOT 1
- An error in NettyUtils.clearPipeline HOT 1
- DefaultSessionEventHandler.doEventHandlerMethodLookup should use multiple threads. HOT 2
- Can you provide some benchmark examples? I think this is very important.
- channel broadcasts error data
- the wiki topic "Jetserver internal details and how it works."is too old,can you write a new version for netty version? HOT 1
- using in unity3d HOT 3
- Could you change spring 3.x to spring 4.x HOT 1
- How to run Project (play game)
- status of this project? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from java-game-server.