Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Protobuf Support for .NET Socket #47

Open
wants to merge 33 commits into
base: master
Choose a base branch
from
Open

Conversation

lugehorsam
Copy link
Contributor

@lugehorsam lugehorsam commented Dec 18, 2020

This PR adds protobuf support to the .NET socket via annotations from protobuf-net.

It also moves the concrete socket models to Nakama.Socket.Internal. These are no longer strictly internal because the Nakama.Protobuf .dll needs access to them.

The primary rationale behind using protobuf-net was its annotations feature. This allows us to not need to write glue code between the generated protobuf types and our interfaces.

The plan for Unity support would be to ship our protobuf .dll inside the same asset and simply document that using Nakama.Protobuf will pull in the .dll. Otherwise the .dll will not be included in the build output.

Note there is some duplication between the protobuf and text adapters w/r/t the socket lifecycle methods: Connect Close Send and ReceiveLoop. I debated merging them into some shared object but didn't think it was worth it.

TODO

@lugehorsam lugehorsam mentioned this pull request Feb 9, 2021
@CLAassistant
Copy link

CLAassistant commented Mar 21, 2021

CLA assistant check
All committers have signed the CLA.

/// A Protobuf-Net serializable class corresponding to the well-known
/// google.protobuf.BoolValue type.
///
/// Keep in mind that grpc-gateway will automatically deserialize a vool into a BoolValue;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo

(DataMemberAttribute) Attribute.GetCustomAttribute(member, typeof(DataMemberAttribute), true);
return !string.IsNullOrEmpty(dataMemberAttribute.Name) ? dataMemberAttribute.Name : member.Name;
var dataMemberAttribute = (DataMemberAttribute) Attribute.GetCustomAttribute(member, typeof(DataMemberAttribute), true);
return dataMemberAttribute.Name;
}
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EOF

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants