diff --git a/CONFIGURATION.md b/CONFIGURATION.md index 7b01b2e..4200b90 100644 --- a/CONFIGURATION.md +++ b/CONFIGURATION.md @@ -48,7 +48,7 @@ The configuration for Gaurun has some sections. The example is [here](conf/gauru |keepalive_timeout|int |time for continuing keep-alive connection to GCM|90 | | |keepalive_conns |int |number of keep-alive connection to GCM |runtime.NumCPU()|| |retry_max |int |maximum retry count for push notication to GCM |1 | | -|use_fcm |bool |Use FCM endpoint instead of GCM (by default, `gaurun` uses GCM endpoint) |false | | +|use_fcm |bool |Use FCM endpoint instead of GCM (by default, `gaurun` uses FCM endpoint) |true | | ## Log Section diff --git a/gaurun/client.go b/gaurun/client.go index 811ecab..3ec9549 100644 --- a/gaurun/client.go +++ b/gaurun/client.go @@ -26,11 +26,11 @@ func keepAliveInterval(keepAliveTimeout int) int { // InitGCMClient initializes GCMClient which is globally declared. func InitGCMClient() error { - // By default, use GCM endpoint. If UseFCM is explicitly enabled via configuration, - // use FCM endpoint. - url := gcm.GCMSendEndpoint - if ConfGaurun.Android.UseFCM { - url = gcm.FCMSendEndpoint + // By default, use FCM endpoint. If UseFCM is explicitly disabled via configuration, + // use GCM endpoint. + url := gcm.FCMSendEndpoint + if !ConfGaurun.Android.UseFCM { + url = gcm.GCMSendEndpoint } var err error diff --git a/gaurun/conf.go b/gaurun/conf.go index d6706d0..8e09815 100644 --- a/gaurun/conf.go +++ b/gaurun/conf.go @@ -75,7 +75,7 @@ func BuildDefaultConf() ConfToml { conf.Android.KeepAliveTimeout = 90 conf.Android.KeepAliveConns = numCPU conf.Android.RetryMax = 1 - conf.Android.UseFCM = false + conf.Android.UseFCM = true // iOS conf.Ios.Enabled = true conf.Ios.PemCertPath = "" diff --git a/gaurun/conf_test.go b/gaurun/conf_test.go index 6c896d7..a3f71a2 100644 --- a/gaurun/conf_test.go +++ b/gaurun/conf_test.go @@ -44,7 +44,7 @@ func (suite *ConfigTestSuite) TestValidateConfDefault() { assert.Equal(suite.T(), suite.ConfGaurunDefault.Android.KeepAliveTimeout, 90) assert.Equal(suite.T(), int64(suite.ConfGaurunDefault.Android.KeepAliveConns), suite.ConfGaurunDefault.Core.WorkerNum) assert.Equal(suite.T(), suite.ConfGaurunDefault.Android.RetryMax, 1) - assert.Equal(suite.T(), suite.ConfGaurunDefault.Android.UseFCM, false) + assert.Equal(suite.T(), suite.ConfGaurunDefault.Android.UseFCM, true) // Ios assert.Equal(suite.T(), suite.ConfGaurunDefault.Ios.Enabled, true) assert.Equal(suite.T(), suite.ConfGaurunDefault.Ios.PemCertPath, "")