Mirror icon indicating copy to clipboard operation
Mirror copied to clipboard

Add Interface for a port field for Transports so that it is easier to set

Open James-Frowen opened this issue 5 years ago • 6 comments

we should add an interface to set the port, this will maker it easier for users to cast the transport and then set the port

    public interface IPortTransport
    {
        public ushort Port { get; set; }
    }

It'd be best to do this after we split the transports, and make sure to inform transport creators about this interface so they added it if needed.

James-Frowen avatar Jan 01 '21 12:01 James-Frowen

so each transport decides if it wants to implement this interface or not right?

paulpach avatar Jan 01 '21 15:01 paulpach

+1

JesusLuvsYooh avatar Jan 01 '21 16:01 JesusLuvsYooh

so each transport decides if it wants to implement this interface or not right?

yes, so telepathy would implement this, but steam transport (I think) wouldn't

eg

public class TelepathyTransport : Transport, IPortTransport
if (Transport.activeTrasnport is IPortTransport portTransport) 
{
    portTransport.Port = 8000;
}

James-Frowen avatar Jan 01 '21 16:01 James-Frowen

Is there a transport template people use when creating them, so they know what to add.

JesusLuvsYooh avatar Jan 01 '21 16:01 JesusLuvsYooh

then this is a good idea.

paulpach avatar Jan 01 '21 16:01 paulpach

Is there a transport template people use when creating them, so they know what to add.

Not that I am aware of, Mostly you just have to override the methods (although there are a few unwritten things like invoke callbacks on main thread. We are splitting the transports into server/client soon so we could maybe have a template then.

James-Frowen avatar Jan 01 '21 17:01 James-Frowen