Upgrade to Pro — share decks privately, control downloads, hide ads and more …

gRPC

Moyuru Aizawa
September 15, 2017

 gRPC

Moyuru Aizawa

September 15, 2017
Tweet

More Decks by Moyuru Aizawa

Other Decks in Programming

Transcript

  1. ‣ Google ‣ Remote Procedure Call ‣ HTTP/2 ‣ ѹॖϔομʔ

    ‣ αʔόʔϓογϡ ‣ Protocol Buffers ‣ ετϦʔϜ ‣ … gRPC
  2. ‣ FRESH!։ൃ ‣ gRPC Stream, Server Sent EventΛ༻͍ͨ൚༻తͳServer Pushϛυϧ ΢ΣΞ

    ‣ ΫϥΠΞϯτ͸Plasmaʹରͯ͠subscribe͍ͨ͠EventΛૹΔ ‣ Πϕϯτൃੜ࣌ʹPlasma͕ΫϥΠΞϯτʹରͯ͠৘ใΛૹΔ ‣ https://blog.stormcat.io/post/entry/openfresh-plasma/ Plasma
  3. gRPC Client Plasma Connect to server subscribe Event1 Event1 subscribe

    Event2 Event1 Event2 ແବͳϦΫΤετͷ࡟ݮ ϦΞϧλΠϜ
  4. apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'com.google.protobuf' apply

    plugin: 'com.android.application' apply plugin: 'com.google.protobuf' apply plugin: 'kotlin-android' Kotlin and Protobuf
  5. ManagedChannel and Lifecycle onCreate onDestroy channel.shutdownNow() the system will simply

    kill the activity's hosting process without calling onDestroy new ManagedChannel() FooServiceStubGrpc.newStub(channel) stub.bar()
  6. ManagedChannel and Lifecycle onCreate onDestroy channel.shutdownNow() new ManagedChannel() FooServiceStubGrpc.newStub(channel) stub.bar()

    αʔόʔʹແବͳίωΫγϣϯ͕ཷ·͍ͬͯ͘ ΞϓϦ͕όοΫάϥ΢ϯυͰ΋௨৴ͯ͠͠·͏
  7. class TlsSocketFactory(private val delegate: SSLSocketFactory) : SSLSocketFactory() { override fun

    getDefaultCipherSuites(): Array<String> = delegate.defaultCipherSuites override fun createSocket(s: Socket?, host: String?, port: Int, autoClose: Boolean): Socket = delegate.createSocket(s, host, port, autoClose).let(this::patch) override fun createSocket(host: String?, port: Int): Socket = delegate.createSocket(host, port).let(this::patch) override fun createSocket(host: String?, port: Int, localHost: InetAddress?, localPort: Int): Socket = delegate.createSocket(host, port, localHost, localPort).let(this::patch) override fun createSocket(host: InetAddress?, port: Int): Socket = delegate.createSocket(host, port).let(this::patch) override fun createSocket(address: InetAddress?, port: Int, localAddress: InetAddress?, localPort: Int): Socket = delegate.createSocket(address, port, localAddress, localPort).let(this::patch) override fun getSupportedCipherSuites(): Array<String> = delegate.supportedCipherSuites private fun patch(s: Socket): Socket = s.apply { if (this is SSLSocket) enabledProtocols = arrayOf("TLSv1.2") } } Enable TLS 1.2 https://github.com/square/okhttp/issues/2372
  8. class TlsSocketFactory(private val delegate: SSLSocketFactory) : SSLSocketFactory() { override fun

    getDefaultCipherSuites(): Array<String> = delegate.defaultCipherSuites override fun createSocket(s: Socket?, host: String?, port: Int, autoClose: Boolean): Socket = delegate.createSocket(s, host, port, autoClose).let(this::patch) override fun createSocket(host: String?, port: Int): Socket = delegate.createSocket(host, port).let(this::patch) override fun createSocket(host: String?, port: Int, localHost: InetAddress?, localPort: Int): Socket = delegate.createSocket(host, port, localHost, localPort).let(this::patch) override fun createSocket(host: InetAddress?, port: Int): Socket = delegate.createSocket(host, port).let(this::patch) override fun createSocket(address: InetAddress?, port: Int, localAddress: InetAddress?, localPort: Int): Socket = delegate.createSocket(address, port, localAddress, localPort).let(this::patch) override fun getSupportedCipherSuites(): Array<String> = delegate.supportedCipherSuites private fun patch(s: Socket): Socket = s.apply { if (this is SSLSocket) enabledProtocols = arrayOf("TLSv1.2") } } Enable TLS 1.2 https://github.com/square/okhttp/issues/2372
  9. class TlsSocketFactory(private val delegate: SSLSocketFactory) : SSLSocketFactory() { override fun

    getDefaultCipherSuites(): Array<String> = delegate.defaultCipherSuites override fun createSocket(s: Socket?, host: String?, port: Int, autoClose: Boolean): Socket = delegate.createSocket(s, host, port, autoClose).let(this::patch) override fun createSocket(host: String?, port: Int): Socket = delegate.createSocket(host, port).let(this::patch) override fun createSocket(host: String?, port: Int, localHost: InetAddress?, localPort: Int): Socket = delegate.createSocket(host, port, localHost, localPort).let(this::patch) override fun createSocket(host: InetAddress?, port: Int): Socket = delegate.createSocket(host, port).let(this::patch) override fun createSocket(address: InetAddress?, port: Int, localAddress: InetAddress?, localPort: Int): Socket = delegate.createSocket(address, port, localAddress, localPort).let(this::patch) override fun getSupportedCipherSuites(): Array<String> = delegate.supportedCipherSuites private fun patch(s: Socket): Socket = s.apply { if (this is SSLSocket) enabledProtocols = arrayOf("TLSv1.2") } } Enable TLS 1.2 SSLSocketFactoryΛϥοϓͯ͠TLS 1.2Λ༗ޮʹ͢Δ https://github.com/square/okhttp/issues/2372